AI Summary 60.12522.0 PyTorch torch.sqrt 函数摘要 2026-08-03
PyTorch torch.sqrt 函数 Pytorch torch 参考手册 torch.sqrt 是 PyTorch 中用于计算张量逐元素平方根的函数。 函数定义 torch.sqrt(input, out=None) 使用示例 实例 [mycode4 type='python'] import torch x = torch.tensor([4.0, 9.0, 16.0, 25.0]) ..
PyTorch torch.sqrt 函数
torch.sqrt 是 PyTorch 中用于计算张量逐元素平方根的函数。
函数定义
torch.sqrt(input, out=None)
使用示例
实例
import torch
x = torch.tensor([4.0, 9.0, 16.0, 25.0])
y = torch.sqrt(x)
print(y)
x = torch.tensor([4.0, 9.0, 16.0, 25.0])
y = torch.sqrt(x)
print(y)
输出结果为:
tensor([2., 3., 4., 5.])
Pytorch torch 参考手册