  # Python | Tensorflow logic_or () method The `tensorflow.math ` module provides support for many basic mathematical operations. The ` tf.logical_or () ` [alias ` tf.math.logical_or `] provides support for the logical OR function in Tensorflow. Input of type bool is expected. Input types are tensor, and if they contain more than one element, an elementwise logical OR is calculated, ,

Syntax : tf.logical_or (x, y, name = None) or tf.math.logical_or (x, y, name = None)

Parameters :
x : A Tensor of type bool.
y : A Tensor of type bool.
name (optional): The name for the operation.

Return type : A Tensor of bool type with the same size as that of x or y.

Code :

` `

` # Import Tensorflow library import tensorflow as tf   # Constant vector of size 4 < / code> a = tf.constant ([ True , False , True , False ], dtype = tf. bool ) b = tf.constant ([ True , False , False , True ], dtype = tf. bool )    # Using the OR function and # saving the result to & # 39; c & # 39; c = tf. logical_or (a, b, name = `logical_or` )   # Initiating a Tensorflow session with tf.Session () as sess: print ( `Input type:` , a) print ( ` Input a: ` , sess.run (a))   print  ( `Input b:` , sess.run (b)) print ( `Return type:` , c) print ( `Output:` , sess.run (c)) `

Output:

` Input type: Tensor ("Const: 0", shape = (4,), dtype = bool) Input a: [True False True False] Input b: [True False False True] Return type: Tensor ("logical_and: 0", shape = (4,), dtype = bool) Output: [True False True True] `