Python - Tensorflow bitwise.right_shift() method Last Updated : 04 Jun, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report Tensorflow bitwise.right_shift() method performs the right_shift operation on input a defined by input b and return the new constant. The operation is done on the representation of a and b. This method belongs to bitwise module. Syntax: tf.bitwise.right_shift( a, b, name=None) Arguments a: This must be a Tensor. It should be from the one of the following types: int8, int16, int32, int64, uint8, uint16, uint32, uint64. b: This should also be a Tensor, Type same as a. name: This is optional parameter and this is the name of the operation. Return: It returns a Tensor having the same type as a and b. Let's see this concept with the help of few examples: Example 1: Python3 # Importing the Tensorflow library import tensorflow as tf # A constant a and b a = tf.constant(256, dtype = tf.int32) b = tf.constant(1, dtype = tf.int32) # Applying the right_shift() function # storing the result in 'c' c = tf.bitwise.right_shift(a, b) # Initiating a Tensorflow session with tf.Session() as sess: print("Input 1", a) print(sess.run(a)) print("Input 2", b) print(sess.run(b)) print("Output: ", c) print(sess.run(c)) Output: Input 1 Tensor("Const_57:0", shape=(), dtype=int32) 256 Input 2 Tensor("Const_58:0", shape=(), dtype=int32) 1 Output: Tensor("RightShift_3:0", shape=(), dtype=int32) 128 Example 2: Python3 # Importing the Tensorflow library import tensorflow as tf # A constant a and b a = tf.constant([8, 16, 32], dtype = tf.int32) b = tf.constant([2, 2, 3], dtype = tf.int32) # Applying the right_shift() function # storing the result in 'c' c = tf.bitwise.right_shift(a, b) # Initiating a Tensorflow session with tf.Session() as sess: print("Input 1", a) print(sess.run(a)) print("Input 2", b) print(sess.run(b)) print("Output: ", c) print(sess.run(c)) Output: Input 1 Tensor("Const_53:0", shape=(3, ), dtype=int32) [ 8 16 32] Input 2 Tensor("Const_54:0", shape=(3, ), dtype=int32) [2 2 3] Output: Tensor("RightShift_1:0", shape=(3, ), dtype=int32) [2 4 4] Comment More infoAdvertise with us Next Article Python - Tensorflow bitwise.right_shift() method P PranchalKatiyar Follow Improve Article Tags : Python Tensorflow Python-Tensorflow Practice Tags : python Similar Reads Python - Tensorflow bitwise.left_shift() method Tensorflow bitwise.left_shift() method performs the left_shift operation on input a defined by input b and return the new constant. The operation is done on the representation of a and b. This method belongs to bitwise module. Syntax: tf.bitwise.left_shift( a, b, name=None) Arguments a: This must be 2 min read Python - Tensorflow bitwise.invert() method Tensorflow bitwise.invert() method performs the invert operation and the result will invert the bits, Like 0 to 1 and 1 to 0. The operation is done on the representation of a. This method belongs to bitwise module. Syntax: tf.bitwise.invert( a, name=None) Arguments a: This must be a Tensor.It should 2 min read Python | tensorflow.bitcast() method TensorFlow is open-source python library designed by Google to develop Machine Learning models and deep learning neural networks. bitcast() is method in tensorflow library which is used to bitcast a tensor from one type to another type. It doesn't copy the data. Syntax: tf.bitcast( input, type, name 2 min read Python - Tensorflow bitwise.bitwise_or() method Tensorflow bitwise.bitwise_or() method performs the bitwise_or operation and return those bits set, that are either set(1) in a or in b or in both. The operation is done on the representation of a and b. This method belongs to bitwise module. Syntax: tf.bitwise.bitwise_or( a, b, name=None) Arguments 2 min read Tensorflow bitwise.bitwise_xor() method - Python Tensorflow bitwise.bitwise_xor() method performs the bitwise_xor operation and the result will set those bits, that are different in a and b. The operation is done on the representation of a and b. This method belongs to bitwise module. Syntax: tf.bitwise.bitwise_xor(a, b, name=None) Arguments a: Th 2 min read Like