别出心裁!DOTA2震中杯最新宣传片竟是FC画风

paddle. all ( x: Tensor, axis: int | Sequence[int] | None = None, keepdim: bool = False, name: str | None = None ) Tensor [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’, ‘float32’, ‘float64’, ‘int32’, ‘int64’, ‘complex64’, ‘complex128’.

  • axis (int|list|tuple|None, 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|None, 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
Tensor(shape=[2, 2], dtype=int32, place=Place(cpu), stop_gradient=True,
[[1, 0],
 [1, 1]])
>>> x = paddle.cast(x, 'bool')

>>> # out1 should be False
>>> out1 = paddle.all(x)
>>> out1
Tensor(shape=[], dtype=bool, place=Place(cpu), stop_gradient=True,
False)

>>> # out2 should be [True, False]
>>> out2 = paddle.all(x, axis=0)
>>> out2
Tensor(shape=[2], dtype=bool, place=Place(cpu), stop_gradient=True,
[True , False])

>>> # keepdim=False, out3 should be [False, True], out.shape should be (2,)
>>> out3 = paddle.all(x, axis=-1)
>>> out3
Tensor(shape=[2], dtype=bool, place=Place(cpu), stop_gradient=True,
[False, True ])

>>> # keepdim=True, out4 should be [[False], [True]], out.shape should be (2, 1)
>>> out4 = paddle.all(x, axis=1, keepdim=True)
>>> out4
Tensor(shape=[2, 1], dtype=bool, place=Place(cpu), stop_gradient=True,
[[False],
 [True ]])