PyTorch torch.erf 函数
torch.erf 是 PyTorch 中用于逐元素计算误差函数的函数。
函数定义
torch.erf(input, *, out=None)
使用示例
实例
import torch
# 误差函数示例
x = torch.tensor([0, 0.5, 1.0, 2.0], dtype=torch.float32)
result = torch.erf(x)
print(result) # tensor([0.0000, 0.5205, 0.8427, 0.9953])
# 误差函数示例
x = torch.tensor([0, 0.5, 1.0, 2.0], dtype=torch.float32)
result = torch.erf(x)
print(result) # tensor([0.0000, 0.5205, 0.8427, 0.9953])

Pytorch torch 参考手册