On this page
tf.math.logical_xor
Logical XOR function.
tf.math.logical_xor(
    x, y, name='LogicalXor'
)
  x ^ y = (x | y) & ~(x & y)
The operation works for the following input types:
- Two single elements of type 
bool - One 
tf.Tensorof typebooland one singlebool, where the result will be calculated by applying logical XOR with the single element to each element in the larger Tensor. - Two 
tf.Tensorobjects of typeboolof the same shape. In this case, the result will be the element-wise logical XOR of the two input tensors. 
Usage:
a = tf.constant([True])
b = tf.constant([False])
tf.math.logical_xor(a, b)
<tf.Tensor: shape=(1,), dtype=bool, numpy=array([ True])>
  c = tf.constant([True])
x = tf.constant([False, True, True, False])
tf.math.logical_xor(c, x)
<tf.Tensor: shape=(4,), dtype=bool, numpy=array([ True, False, False,  True])>
  y = tf.constant([False, False, True, True])
z = tf.constant([False, True, False, True])
tf.math.logical_xor(y, z)
<tf.Tensor: shape=(4,), dtype=bool, numpy=array([False,  True,  True, False])>
  
  | Returns | |
|---|---|
A tf.Tensor of type bool with the same size as that of x or y. | 
     
© 2020 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
 https://www.tensorflow.org/versions/r2.3/api_docs/python/tf/math/logical_xor