PyTorch torch.i0 函数

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

PyTorch torch.i0 函数


torch.i0 是 PyTorch 中用于计算第一类修正贝塞尔函数(Modified Bessel Function of the First Kind)阶数为0的函数。

函数定义

torch.i0(input)

使用示例

实例

import torch

# 计算第一类修正贝塞尔函数
x = torch.tensor([0.0, 1.0, 2.0, 3.0])
y = torch.i0(x)
print("I0(x):", y)

输出结果为:

I0(x): tensor([1.0000, 1.2661, 2.2796, 4.8808])