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

PyTorch torch.arctan2 function

PyTorch torch.arctan2 function


PyTorch torch reference manual PyTorch torch reference manual

torch.arctan2 is a function in PyTorch used to compute the element-wise two-argument arctangent (arctangent2), the same as torch.atan2 in functionality.

Function definition

torch.arctan2(input, other, out=None)

Parameter Description


Usage examples

Example

import

torch

Creating tensors

y

=

torch.

tensor

(

[

0.0

,

1.0

,

1.0

,

1.0

]

)

x

=

torch.

tensor

(

[

1.0

,

0.0

,

0.0

,

1.0

]

)

Compute the two-argument arctangent

result

=

torch.

arctan2

(

y

,

x

)

print

(

result

)

The output is:

tensor([ 0.0000,  1.5708, -1.5708,  2.3562])


PyTorch torch reference manual PyTorch torch reference manual