PyTorch torch.exp 函数

约 213 字 更新于 2026-11-18 5iyo.com

PyTorch torch.exp 函数


torch.exp 是 PyTorch 中用于计算逐元素指数函数的函数。

函数定义

torch.exp(input, out=None)

使用示例

实例

import torch

x = torch.tensor([0, 1, 2])

print(torch.exp(x))

输出结果为:

tensor([1.0000, 2.7183, 7.3891])