TUTORIALAI 与数据科学FETCHED
PyTorch torch.reciprocal 函数
PyTorch torch.reciprocal 函数 Pytorch torch 参考手册 torch.reciprocal 是 PyTorch 中用于计算逐元素倒数的函数。 函数定义 torch.reciprocal(input, out=None) 使用示例 实例 [mycode4 type='python'] import torch # 计算逐元素倒数 x = torch.tensor..
更新于 2026/7/16
教程详情页默认 noindex。
PyTorch torch.reciprocal 函数
torch.reciprocal 是 PyTorch 中用于计算逐元素倒数的函数。
函数定义
torch.reciprocal(input, out=None)
使用示例
实例
import torch
# 计算逐元素倒数
x = torch.tensor([1.0, 2.0, 4.0])
result = torch.reciprocal(x)
print(result)
# 计算逐元素倒数
x = torch.tensor([1.0, 2.0, 4.0])
result = torch.reciprocal(x)
print(result)
Pytorch torch 参考手册