Tensorflow bitwise.bitwise_xor() method - Python Last Updated : 26 May, 2020 Comments Improve Suggest changes Like Article Like Report 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: 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(43, dtype = tf.int32) b = tf.constant(5, dtype = tf.int32) # Applying the bitwise_xor function # storing the result in 'c' c = tf.bitwise.bitwise_xor(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_36:0", shape=(), dtype=int32) 43 Input 2 Tensor("Const_37:0", shape=(), dtype=int32) 5 Output: Tensor("BitwiseXor_4:0", shape=(), dtype=int32) 46 Example 2: Python3 # Importing the Tensorflow library import tensorflow as tf # A constant vector of size 2 a = tf.constant([10, 6], dtype = tf.int32) b = tf.constant([12, 5], dtype = tf.int32) # Applying the bitwise_xor function # storing the result in 'c' c = tf.bitwise.bitwise_xor(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_34:0", shape=(2, ), dtype=int32) [10 6] Input 2 Tensor("Const_35:0", shape=(2, ), dtype=int32) [12 5] Output: Tensor("BitwiseXor_3:0", shape=(2, ), dtype=int32) [6 3] Comment More infoAdvertise with us Next Article Tensorflow bitwise.bitwise_xor() method - Python P PranchalKatiyar Follow Improve Article Tags : Python Tensorflow Python-Tensorflow Practice Tags : python Similar Reads 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 Python - Tensorflow bitwise.bitwise_and() method Tensorflow bitwise.bitwise_and() method performs the bitwise_and operation and return those bits set, that are set(1) in both a and b. The operation is done on the representation of a and b. This method belongs to bitwise module. Syntax: tf.bitwise.bitwise_and( a, b, name=None) Arguments a: This mus 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.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 logical_xor() method Tensorflow is an open-source machine learning library developed by Google. One of its applications is to develop deep neural networks. The module tensorflow.math provides support for many basic logical operations. Function tf.logical_xor() [alias tf.math.logical_xor] provides support for the logical 2 min read Python - Tensorflow bitwise.right_shift() method 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 2 min read Python - tensorflow.boolean_mask() method TensorFlow is open-source Python library designed by Google to develop Machine Learning models and deep learning  neural networks. boolean_mask() is method used to apply boolean mask to a Tensor. Syntax: tensorflow.boolean_mask(tensor, mask, axis, name) Parameters: tensor: It's a N-dimensional input 2 min read Python | Tensorflow logical_and() method Tensorflow is an open-source machine learning library developed by Google. One of its applications is to develop deep neural networks. The module tensorflow.math provides support for many basic logical operations. Function tf.logical_and() [alias tf.math.logical_and] provides support for the logical 2 min read Python | Tensorflow logical_or() method Tensorflow is an open-source machine learning library developed by Google. One of its applications is to develop deep neural networks. The module tensorflow.math provides support for many basic mathematical operations. Function tf.logical_or() [alias tf.math.logical_or] provides support for the logi 2 min read Like