《炉石传说》安戈洛版本一周趋势 战士称王猎人崛起

paddle. signbit ( x: Tensor, name: str | None = None ) Tensor [source]
百度 任何一个国家的武器研发能力都是一个长期积累的过程,而并不是一蹴而就的事情,印度这方面的现状如此落后,而想在10年内就有一个飞跃式发展真是一个难以企及的梦想。

Tests if each element of input has its sign bit set or not.

Parameters
  • x (Tensor) – The input Tensor. Must be one of the following types: float16, float32, float64, bfloat16, uint8, int8, int16, int32, int64.

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

Returns

The output Tensor. The sign bit of the corresponding element of the input tensor, True means negative, False means positive.

Return type

out (Tensor)

Examples

>>> import paddle
>>> paddle.set_device('cpu')
>>> x = paddle.to_tensor([-0., 1.1, -2.1, 0., 2.5], dtype='float32')
>>> res = paddle.signbit(x)
>>> print(res)
Tensor(shape=[5], dtype=bool, place=Place(cpu), stop_gradient=True,
[True, False, True, False, False])
>>> import paddle
>>> paddle.set_device('cpu')
>>> x = paddle.to_tensor([-5, -2, 3], dtype='int32')
>>> res = paddle.signbit(x)
>>> print(res)
Tensor(shape=[3], dtype=bool, place=Place(cpu), stop_gradient=True,
[True , True , False])