PyTorch torch.signbit function
PyTorch torch reference manual
torch.signbit is a function in PyTorch used to check the sign bit element-wise. It returns True if the element is negative.
Function definition
torch.signbit(input, out=None)
Usage examples
Example
import
torch
Check the sign bit element-wise
x
=
torch.
tensor
(
[
2.0
,
0.0
,
3.0
]
)
result
=
torch.
signbit
(
x
)
(
result
)