PyTorch torch.reciprocal Function


Pytorch torch 参考手册PyTorch torch Reference Manual

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

Function Definition

torch.reciprocal(input, out=None)

Usage Example

Example

import torch

# Compute element-wise reciprocal
x = torch.tensor([1.0, 2.0, 4.0])
result = torch.reciprocal(x)
print(result)

Pytorch torch 参考手册PyTorch torch Reference Manual

Other Extensions