Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PyTorch torch.signbit function

PyTorch torch.signbit function


PyTorch torch reference manual 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

)

print

(

result

)


PyTorch torch reference manual PyTorch torch reference manual