View source on GitHub
|
Test whether any array element along a given axis evaluates to True.
tf.keras.ops.any(
x, axis=None, keepdims=False
)
Returns | |
|---|---|
The tensor containing the logical OR reduction over the axis.
|
Examples:
x = keras.ops.convert_to_tensor([True, False])keras.ops.any(x)array(True, shape=(), dtype=bool)
x = keras.ops.convert_to_tensor([[True, False], [True, True]])keras.ops.any(x, axis=0)array([ True True], shape=(2,), dtype=bool)
keepdims=True outputs a tensor with dimensions reduced to one.
>>> x = keras.ops.convert_to_tensor([[True, False], [True, True]])
>>> keras.ops.all(x, keepdims=True)
array([[False]], shape=(1, 1), dtype=bool)
View source on GitHub