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

PyTorch torch.reciprocal function

PyTorch torch.reciprocal function


PyTorch torch reference manual PyTorch torch reference manual

torch.reciprocal is a function in PyTorch used to compute the element-wise reciprocal.

Function definition

torch.reciprocal(input, out=None)


Usage examples

Example

import

torch

Compute the element-wise reciprocal

x

=

torch.

tensor

(

[

1.0

,

2.0

,

4.0

]

)

result

=

torch.

reciprocal

(

x

)

print

(

result

)


PyTorch torch reference manual PyTorch torch reference manual