View source on GitHub |
Test whether all array elements along a given axis evaluate to True
.
tf.keras.ops.all(
x, axis=None, keepdims=False
)
Returns | |
---|---|
The tensor containing the logical AND reduction over the axis .
|
Examples:
x = keras.ops.convert_to_tensor([True, False])
keras.ops.all(x)
array(False, shape=(), dtype=bool)
x = keras.ops.convert_to_tensor([[True, False], [True, True]])
keras.ops.all(x, axis=0)
array([ True False], 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)