# all¶

paddle. all ( x, axis=None, keepdim=False, name=None ) [source]

Computes the `logical and` of tensor elements over the given dimension.

Parameters
• x (Tensor) – An N-D Tensor, the input data type should be bool.

• axis (int|list|tuple, optional) – The dimensions along which the `logical and` is compute. If `None`, and all elements of `x` and return a Tensor with a single element, otherwise must be in the range \([-rank(x), rank(x))\). If \(axis[i] < 0\), the dimension to reduce is \(rank + axis[i]\).

• keepdim (bool, optional) – Whether to reserve the reduced dimension in the output Tensor. The result Tensor will have one fewer dimension than the `x` unless `keepdim` is true, default value is False.

• name (str, optional) – Name for the operation (optional, default is None). For more information, please refer to Name.

Returns

Results the `logical and` on the specified axis of input Tensor x, it’s data type is bool.

Return type

Tensor

Examples

```>>> import paddle

>>> # x is a bool Tensor with following elements:
>>> #    [[True, False]
>>> #     [True, True]]
>>> x = paddle.to_tensor([[1, 0], [1, 1]], dtype='int32')
>>> x
[[1, 0],
[1, 1]])

>>> # out1 should be False
>>> out1
False)

>>> # out2 should be [True, False]
>>> out2
[True , False])

>>> # keepdim=False, out3 should be [False, True], out.shape should be (2,)