PyTorch torch.reciprocal function
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
)
(
result
)