• 文档 >
  • torch.special
快捷键

torch.special

torch.special 模块,模仿 SciPy 的 special 模块。

函数 ¶

torch.special.airy_ai(input, *, out=None) Tensor

空气函数 Ai(input)\text{Ai}\left(\text{input}\right) .

参数:

输入(张量)- 输入张量。

关键字参数:

输出(张量,可选)- 输出张量。

torch.special.bessel_j0(input, *, out=None) → 张量 ¶

零阶贝塞尔函数 00 .

参数:

输入(张量)- 输入张量。

关键字参数:

输出(张量,可选)- 输出张量。

torch.special.bessel_j1(input, *, out=None) → 张量 ¶

第一类贝塞尔函数,阶数为 11

参数:

输入(张量)- 输入张量。

关键字参数:

out(张量,可选)- 输出张量。

torch.special.digamma(input, *, out=None) → 张量 ¶

计算输入上的伽玛函数的对数导数。

ϝ(x)=ddxln(Γ(x))=Γ(x)Γ(x)\digamma(x) = \frac{d}{dx} \ln\left(\Gamma\left(x\right)\right) = \frac{\Gamma'(x)}{\Gamma(x)}
参数:

输入(张量)- 要计算 digamma 函数的张量

关键字参数:

输出(张量,可选)- 输出张量。

注意

此函数与 SciPy 的 scipy.special.digamma 类似。

注意

从 PyTorch 1.8 版本开始,digamma 函数对于 0 返回-Infinity,之前返回 NaN。

示例:

>>> a = torch.tensor([1, 0.5])
>>> torch.special.digamma(a)
tensor([-0.5772, -1.9635])
torch.special.entr(input, *, out=None) → 张量

计算如下的熵 input (如下定义),逐元素计算。

entr(x)={xln(x)x>00x=0.0x<0\begin{align} \text{entr(x)} = \begin{cases} -x * \ln(x) & x > 0 \\ 0 & x = 0.0 \\ -\infty & x < 0 \end{cases} \end{align}
参数:

输入(张量)- 输入张量。

关键字参数:

输出(张量,可选)- 输出张量。

示例::
>>> a = torch.arange(-0.5, 1, 0.5)
>>> a
tensor([-0.5000,  0.0000,  0.5000])
>>> torch.special.entr(a)
tensor([  -inf, 0.0000, 0.3466])
torch.special.erf(input, *, out=None) → 张量 ¶

计算如下的误差函数 input 。误差函数定义如下:

erf(x)=2π0xet2dt\mathrm{erf}(x) = \frac{2}{\sqrt{\pi}} \int_{0}^{x} e^{-t^2} dt
参数:

输入(张量)- 输入张量。

关键字参数:

输出(张量,可选)- 输出张量。

示例:

>>> torch.special.erf(torch.tensor([0, -1., 10.]))
tensor([ 0.0000, -0.8427,  1.0000])
torch.special.erfc(input, *, out=None) → 张量

计算参数 input 的补余误差函数。补余误差函数定义为以下:

erfc(x)=12π0xet2dt\mathrm{erfc}(x) = 1 - \frac{2}{\sqrt{\pi}} \int_{0}^{x} e^{-t^2} dt
参数:

输入(张量)- 输入张量。

关键字参数:

输出(张量,可选)- 输出张量。

示例:

>>> torch.special.erfc(torch.tensor([0, -1., 10.]))
tensor([ 1.0000, 1.8427,  0.0000])
torch.special.erfcx(input, *, out=None) Tensor

计算每个元素的缩放互补误差函数。缩放互补误差函数定义为以下:

erfcx(x)=ex2erfc(x)\mathrm{erfcx}(x) = e^{x^2} \mathrm{erfc}(x)
参数:

input (Tensor) – 输入张量。

关键字参数:

输出(张量,可选)- 输出张量。

示例:

>>> torch.special.erfcx(torch.tensor([0, -1., 10.]))
tensor([ 1.0000, 5.0090, 0.0561])
torch.special.erfinv(input, *, out=None) Tensor

计算逆误差函数 input 。逆误差函数在范围 (1,1)(-1, 1) 中定义为:

erfinv(erf(x))=x\mathrm{erfinv}(\mathrm{erf}(x)) = x
参数:

输入(张量)- 输入张量。

关键字参数:

输出(张量,可选)- 输出张量。

示例:

>>> torch.special.erfinv(torch.tensor([0, 0.5, -1.]))
tensor([ 0.0000,  0.4769,    -inf])
torch.special.exp2(input, *, out=None) → 张量 ¶

计算以 2 为底的对数指数函数 input

yi=2xiy_{i} = 2^{x_{i}}
参数:

输入(张量)- 输入张量。

关键字参数:

输出(张量,可选)- 输出张量。

示例:

>>> torch.special.exp2(torch.tensor([0, math.log2(2.), 3, 4]))
tensor([ 1.,  2.,  8., 16.])
torch.special.expit(input, *, out=None) → 张量 ¶

计算元素 input 的 expit(也称为逻辑 sigmoid 函数)。

outi=11+einputi\text{out}_{i} = \frac{1}{1 + e^{-\text{input}_{i}}}
参数:

输入(张量)- 输入张量。

关键字参数:

输出(张量,可选)- 输出张量。

示例:

>>> t = torch.randn(4)
>>> t
tensor([ 0.9213,  1.0887, -0.8858, -1.7683])
>>> torch.special.expit(t)
tensor([ 0.7153,  0.7481,  0.2920,  0.1458])
torch.special.expm1(input, *, out=None) Tensor

计算元素 input 的指数减 1。

yi=exi1y_{i} = e^{x_{i}} - 1

注意

此函数对于小的 x 值,比 exp(x) - 1 提供了更高的精度。

参数:

input (Tensor) – 输入张量。

关键字参数:

输出(张量,可选)- 输出张量。

示例:

>>> torch.special.expm1(torch.tensor([0, math.log(2.)]))
tensor([ 0.,  1.])
torch.special.gammainc(input, other, *, out=None) Tensor

计算正则化下不完全伽马函数:

outi=1Γ(inputi)0otheritinputi1etdt\text{out}_{i} = \frac{1}{\Gamma(\text{input}_i)} \int_0^{\text{other}_i} t^{\text{input}_i-1} e^{-t} dt

其中 inputi\text{input}_iotheri\text{other}_i 都是弱正数,且至少有一个是严格正数。如果两者都是零或其中一个是负数,则上述方程中的 outi=nan\text{out}_i=\text{nan} . Γ()\Gamma(\cdot) 是伽马函数,

Γ(inputi)=0t(inputi1)etdt.\Gamma(\text{input}_i) = \int_0^\infty t^{(\text{input}_i-1)} e^{-t} dt.

请参阅 torch.special.gammaincc()torch.special.gammaln() 以获取相关函数。

支持广播到公共形状和浮点输入。

注意

关于 input 的反向传播尚未支持。请打开 PyTorch 的 Github 上的问题来请求它。

参数:
  • 输入(张量)- 第一个非负输入张量

  • 其他(张量)- 第二个非负输入张量

关键字参数:

输出(张量,可选)- 输出张量。

示例:

>>> a1 = torch.tensor([4.0])
>>> a2 = torch.tensor([3.0, 4.0, 5.0])
>>> a = torch.special.gammaincc(a1, a2)
tensor([0.3528, 0.5665, 0.7350])
tensor([0.3528, 0.5665, 0.7350])
>>> b = torch.special.gammainc(a1, a2) + torch.special.gammaincc(a1, a2)
tensor([1., 1., 1.])
torch.special.gammaincc(input, other, *, out=None) Tensor

计算正则化上不完全伽马函数:

outi=1Γ(inputi)otheritinputi1etdt\text{out}_{i} = \frac{1}{\Gamma(\text{input}_i)} \int_{\text{other}_i}^{\infty} t^{\text{input}_i-1} e^{-t} dt

其中 inputi\text{input}_iotheri\text{other}_i 都是弱正数,且至少有一个是严格正数。如果两者都是零或其中一个是负数,则上述方程中的 outi=nan\text{out}_i=\text{nan} . Γ()\Gamma(\cdot) 是伽马函数,

Γ(inputi)=0t(inputi1)etdt.\Gamma(\text{input}_i) = \int_0^\infty t^{(\text{input}_i-1)} e^{-t} dt.

请参阅 torch.special.gammainc()torch.special.gammaln() 以获取相关函数。

支持广播到公共形状和浮点输入。

注意

关于 input 的反向传播尚未支持。请打开 PyTorch 的 Github 上的问题来请求它。

参数:
  • 输入(张量)- 第一个非负输入张量

  • 其他(张量)- 第二个非负输入张量

关键字参数:

输出(张量,可选)- 输出张量。

示例:

>>> a1 = torch.tensor([4.0])
>>> a2 = torch.tensor([3.0, 4.0, 5.0])
>>> a = torch.special.gammaincc(a1, a2)
tensor([0.6472, 0.4335, 0.2650])
>>> b = torch.special.gammainc(a1, a2) + torch.special.gammaincc(a1, a2)
tensor([1., 1., 1.])
torch.special.gammaln(input, *, out=None) Tensor

计算伽玛函数在 input 上的自然对数。

outi=lnΓ(inputi)\text{out}_{i} = \ln \Gamma(|\text{input}_{i}|)
参数:

input (Tensor) – 输入张量。

关键字参数:

输出(张量,可选)- 输出张量。

示例:

>>> a = torch.arange(0.5, 2, 0.5)
>>> torch.special.gammaln(a)
tensor([ 0.5724,  0.0000, -0.1208])
torch.special.i0(input, *, out=None) Tensor

计算每个元素的第 0 阶修正贝塞尔函数,输入为 input

outi=I0(inputi)=k=0(inputi2/4)k(k!)2\text{out}_{i} = I_0(\text{input}_{i}) = \sum_{k=0}^{\infty} \frac{(\text{input}_{i}^2/4)^k}{(k!)^2}
参数:

输入(张量)- 输入张量

关键字参数:

输出(张量,可选)- 输出张量。

示例:

>>> torch.i0(torch.arange(5, dtype=torch.float32))
tensor([ 1.0000,  1.2661,  2.2796,  4.8808, 11.3019])
torch.special.i0e(input, *, out=None) → 张量

计算每个元素的第 0 阶指数缩放修正贝塞尔函数(如下定义)

outi=exp(x)i0(x)=exp(x)k=0(inputi2/4)k(k!)2\text{out}_{i} = \exp(-|x|) * i0(x) = \exp(-|x|) * \sum_{k=0}^{\infty} \frac{(\text{input}_{i}^2/4)^k}{(k!)^2}
参数:

输入(张量)- 输入张量

关键字参数:

输出(张量,可选)- 输出张量。

示例::
>>> torch.special.i0e(torch.arange(5, dtype=torch.float32))
tensor([1.0000, 0.4658, 0.3085, 0.2430, 0.2070])
torch.special.i1(input, *, out=None) Tensor

计算每个元素的第一类修正贝塞尔函数(如下定义)。

outi=(inputi)2k=0(inputi2/4)k(k!)(k+1)!\text{out}_{i} = \frac{(\text{input}_{i})}{2} * \sum_{k=0}^{\infty} \frac{(\text{input}_{i}^2/4)^k}{(k!) * (k+1)!}
参数:

input (Tensor) – 输入张量。

关键字参数:

输出(张量,可选)- 输出张量。

示例::
>>> torch.special.i1(torch.arange(5, dtype=torch.float32))
tensor([0.0000, 0.5652, 1.5906, 3.9534, 9.7595])
torch.special.i1e(input, *, out=None) Tensor

计算每个元素的第 0#的指数缩放一阶修正贝塞尔函数(如下定义)。

outi=exp(x)i1(x)=exp(x)(inputi)2k=0(inputi2/4)k(k!)(k+1)!\text{out}_{i} = \exp(-|x|) * i1(x) = \exp(-|x|) * \frac{(\text{input}_{i})}{2} * \sum_{k=0}^{\infty} \frac{(\text{input}_{i}^2/4)^k}{(k!) * (k+1)!}
参数:

输入(张量)- 输入张量。

关键字参数:

输出(张量,可选)- 输出张量。

示例::
>>> torch.special.i1e(torch.arange(5, dtype=torch.float32))
tensor([0.0000, 0.2079, 0.2153, 0.1968, 0.1788])
torch.special.log1p(input, *, out=None) → 张量

torch.log1p() 的别名

torch.special.log_ndtr(input, *, out=None) → 张量

计算标准高斯概率密度函数下的面积对数,从负无穷大到 input 的积分,逐元素计算。

log_ndtr(x)=log(12πxe12t2dt)\text{log\_ndtr}(x) = \log\left(\frac{1}{\sqrt{2 \pi}}\int_{-\infty}^{x} e^{-\frac{1}{2}t^2} dt \right)
参数:

输入(张量)- 输入张量。

关键字参数:

输出(张量,可选)- 输出张量。

示例::
>>> torch.special.log_ndtr(torch.tensor([-3., -2, -1, 0, 1, 2, 3]))
tensor([-6.6077 -3.7832 -1.841  -0.6931 -0.1728 -0.023  -0.0014])
torch.special.log_softmax(input, dim, *, dtype=None) → 张量 ¶

计算 softmax 后跟对数。

虽然在数学上等同于 log(softmax(x)),但分别执行这两个操作会更慢且数值上不稳定。此函数的计算方式为:

log_softmax(xi)=log(exp(xi)jexp(xj))\text{log\_softmax}(x_{i}) = \log\left(\frac{\exp(x_i) }{ \sum_j \exp(x_j)} \right)
参数:
  • 输入(张量)- 输入

  • dim(整型)- log_softmax 将要计算的维度。

  • dtype( torch.dtype ,可选)- 返回张量的期望数据类型。如果指定,则在执行操作之前将输入张量转换为 dtype 。这有助于防止数据类型溢出。默认:None。

示例::
>>> t = torch.ones(2, 2)
>>> torch.special.log_softmax(t, 0)
tensor([[-0.6931, -0.6931],
        [-0.6931, -0.6931]])
torch.special.logit(input, eps=None, *, out=None) → Tensor

返回一个新张量,包含 input 的 logit。当 eps 不为 None 时, input 将被限制在[eps, 1 - eps]范围内。当 eps 为 None 且 input < 0 或 input > 1 时,函数将返回 NaN。

yi=ln(zi1zi)zi={xiif eps is Noneepsif xi<epsxiif epsxi1eps1epsif xi>1eps\begin{align} y_{i} &= \ln(\frac{z_{i}}{1 - z_{i}}) \\ z_{i} &= \begin{cases} x_{i} & \text{if eps is None} \\ \text{eps} & \text{if } x_{i} < \text{eps} \\ x_{i} & \text{if } \text{eps} \leq x_{i} \leq 1 - \text{eps} \\ 1 - \text{eps} & \text{if } x_{i} > 1 - \text{eps} \end{cases} \end{align}
参数:
  • input (Tensor) – 输入张量。

  • eps (float, 可选) – 输入限制边界的 epsilon。默认: None

关键字参数:

输出(张量,可选)- 输出张量。

示例:

>>> a = torch.rand(5)
>>> a
tensor([0.2796, 0.9331, 0.6486, 0.1523, 0.6516])
>>> torch.special.logit(a, eps=1e-6)
tensor([-0.9466,  2.6352,  0.6131, -1.7169,  0.6261])
torch.special.logsumexp(input, dim, keepdim=False, *, out=None)

torch.logsumexp() 的别名

torch.special.multigammaln(input, p, *, out=None) Tensor

计算多元对数伽马函数,维度为 pp 元素逐个,表示为

log(Γp(a))=C+i=1plog(Γ(ai12))\log(\Gamma_{p}(a)) = C + \displaystyle \sum_{i=1}^{p} \log\left(\Gamma\left(a - \frac{i - 1}{2}\right)\right)

其中 C=log(π)p(p1)4C = \log(\pi) \cdot \frac{p (p - 1)}{4}Γ()\Gamma(-) 是伽马函数。

所有元素必须大于 p12\frac{p - 1}{2} ,否则行为未定义。

参数:
  • 输入(张量)- 计算多元对数伽马函数的张量

  • p(整数)- 维数数量

关键字参数:

输出(张量,可选)- 输出张量。

示例:

>>> a = torch.empty(2, 3).uniform_(1, 2)
>>> a
tensor([[1.6835, 1.8474, 1.1929],
        [1.0475, 1.7162, 1.4180]])
>>> torch.special.multigammaln(a, 2)
tensor([[0.3928, 0.4007, 0.7586],
        [1.0311, 0.3901, 0.5049]])
torch.special.ndtr(input, *, out=None) → 张量

计算标准高斯概率密度函数下的面积,从负无穷大到 input 的积分,逐元素计算。

ndtr(x)=12πxe12t2dt\text{ndtr}(x) = \frac{1}{\sqrt{2 \pi}}\int_{-\infty}^{x} e^{-\frac{1}{2}t^2} dt
参数:

输入(张量)- 输入张量。

关键字参数:

输出(张量,可选)- 输出张量。

示例::
>>> torch.special.ndtr(torch.tensor([-3., -2, -1, 0, 1, 2, 3]))
tensor([0.0013, 0.0228, 0.1587, 0.5000, 0.8413, 0.9772, 0.9987])
torch.special.ndtri(input, *, out=None) → 张量 ¶

计算高斯概率密度函数下的面积(从负无穷大到 x 的积分)等于 input 的 x 值,逐元素计算。

ndtri(p)=2erf1(2p1)\text{ndtri}(p) = \sqrt{2}\text{erf}^{-1}(2p - 1)

注意

也称为正态分布的分位数函数。

参数:

输入(张量)- 输入张量。

关键字参数:

输出(张量,可选)- 输出张量。

示例::
>>> torch.special.ndtri(torch.tensor([0, 0.25, 0.5, 0.75, 1]))
tensor([   -inf, -0.6745,  0.0000,  0.6745,     inf])
torch.special.polygamma(n, input, *, out=None) → 张量 ¶

计算狄利克雷函数在 input 上的 nthn^{th} 阶导数。 n0n \geq 0 被称为多伽玛函数的阶。

ψ(n)(x)=d(n)dx(n)ψ(x)\psi^{(n)}(x) = \frac{d^{(n)}}{dx^{(n)}} \psi(x)

注意

此函数仅对非负整数 n0n \geq 0 进行实现。

参数:
  • n(int)- 多重 Polygamma 函数的阶

  • 输入(Tensor)- 输入张量。

关键字参数:

输出(张量,可选)- 输出张量。

示例::
>>> a = torch.tensor([1, 0.5])
>>> torch.special.polygamma(1, a)
tensor([1.64493, 4.9348])
>>> torch.special.polygamma(2, a)
tensor([ -2.4041, -16.8288])
>>> torch.special.polygamma(3, a)
tensor([ 6.4939, 97.4091])
>>> torch.special.polygamma(4, a)
tensor([ -24.8863, -771.4742])
torch.special.psi(input, *, out=None) → Tensor

torch.special.digamma() 的别名

torch.special.round(input, *, out=None) → Tensor

torch.round() 的别名

torch.special.scaled_modified_bessel_k0(input, *, out=None) Tensor

缩放修改后的贝塞尔函数第二类阶数 00

参数:

input (Tensor) – 输入张量。

关键字参数:

输出(张量,可选)- 输出张量。

torch.special.scaled_modified_bessel_k1(input, *, out=None) Tensor

二阶修改后的贝塞尔函数的第二类

参数:

输入(张量)- 输入张量。

关键字参数:

输出(张量,可选)- 输出张量。

torch.special.sinc(input, *, out=None) → 张量 ¶

计算归一化的 sinc 函数值

outi={1,if inputi=0sin(πinputi)/(πinputi),otherwise\text{out}_{i} = \begin{cases} 1, & \text{if}\ \text{input}_{i}=0 \\ \sin(\pi \text{input}_{i}) / (\pi \text{input}_{i}), & \text{otherwise} \end{cases}
参数:

输入(张量)- 输入张量。

关键字参数:

输出(张量,可选)- 输出张量。

示例::
>>> t = torch.randn(4)
>>> t
tensor([ 0.2252, -0.2948,  1.0267, -1.1566])
>>> torch.special.sinc(t)
tensor([ 0.9186,  0.8631, -0.0259, -0.1300])
torch.special.softmax(input, dim, *, dtype=None) → 张量 ¶

计算 softmax 函数。

Softmax 定义为:

Softmax(xi)=exp(xi)jexp(xj)\text{Softmax}(x_{i}) = \frac{\exp(x_i)}{\sum_j \exp(x_j)}

它应用于沿 dim 的所有切片,并将它们重新缩放,使得元素位于[0, 1]的范围内,并且总和为 1。

参数:
  • 输入(张量)- 输入

  • dim(整数)- softmax 将计算的维度。

  • dtype( torch.dtype ,可选)- 返回张量的期望数据类型。如果指定,则在执行操作之前将输入张量转换为 dtype 。这有助于防止数据类型溢出。默认:None。

示例::
>>> t = torch.ones(2, 2)
>>> torch.special.softmax(t, 0)
tensor([[0.5000, 0.5000],
        [0.5000, 0.5000]])
torch.special.spherical_bessel_j0(input, *, out=None) Tensor

雅可比球贝塞尔函数第一类,阶数为 00

参数:

输入(Tensor)- 输入张量。

关键字参数:

输出(张量,可选)- 输出张量。

torch.special.xlog1py(input, other, *, out=None) Tensor

使用以下情况计算 input * log1p(other)

outi={NaNif otheri=NaN0if inputi=0.0 and otheri!=NaNinputilog1p(otheri)otherwise\text{out}_{i} = \begin{cases} \text{NaN} & \text{if } \text{other}_{i} = \text{NaN} \\ 0 & \text{if } \text{input}_{i} = 0.0 \text{ and } \text{other}_{i} != \text{NaN} \\ \text{input}_{i} * \text{log1p}(\text{other}_{i})& \text{otherwise} \end{cases}

类似于 SciPy 的 scipy.special.xlog1py。

参数:
  • 输入(数字或张量)- 乘数

  • 其他(数字或张量)- 自变量

注意

至少 inputother 必须是一个张量。

关键字参数:

输出(张量,可选)- 输出张量。

示例:

>>> x = torch.zeros(5,)
>>> y = torch.tensor([-1, 0, 1, float('inf'), float('nan')])
>>> torch.special.xlog1py(x, y)
tensor([0., 0., 0., 0., nan])
>>> x = torch.tensor([1, 2, 3])
>>> y = torch.tensor([3, 2, 1])
>>> torch.special.xlog1py(x, y)
tensor([1.3863, 2.1972, 2.0794])
>>> torch.special.xlog1py(x, 4)
tensor([1.6094, 3.2189, 4.8283])
>>> torch.special.xlog1py(2, y)
tensor([2.7726, 2.1972, 1.3863])
torch.special.xlogy(input, other, *, out=None) Tensor

计算以下情况的 input * log(other)

outi={NaNif otheri=NaN0if inputi=0.0inputilog(otheri)otherwise\text{out}_{i} = \begin{cases} \text{NaN} & \text{if } \text{other}_{i} = \text{NaN} \\ 0 & \text{if } \text{input}_{i} = 0.0 \\ \text{input}_{i} * \log{(\text{other}_{i})} & \text{otherwise} \end{cases}

与 SciPy 的 scipy.special.xlogy 类似。

参数:
  • 输入(数字或张量)- 乘数

  • 其他(数字或张量)- 参数

注意

至少 inputother 之一必须为张量。

关键字参数:

输出(张量,可选)- 输出张量。

示例:

>>> x = torch.zeros(5,)
>>> y = torch.tensor([-1, 0, 1, float('inf'), float('nan')])
>>> torch.special.xlogy(x, y)
tensor([0., 0., 0., 0., nan])
>>> x = torch.tensor([1, 2, 3])
>>> y = torch.tensor([3, 2, 1])
>>> torch.special.xlogy(x, y)
tensor([1.0986, 1.3863, 0.0000])
>>> torch.special.xlogy(x, 4)
tensor([1.3863, 2.7726, 4.1589])
>>> torch.special.xlogy(2, y)
tensor([2.1972, 1.3863, 0.0000])
torch.special.zeta(input, other, *, out=None) Tensor

计算 Hurwitz zeta 函数,逐元素。

ζ(x,q)=k=01(k+q)x\zeta(x, q) = \sum_{k=0}^{\infty} \frac{1}{(k + q)^x}
参数:
  • input (Tensor) – 对应于 x 的输入张量。

  • other (Tensor) – 对应于 q 的输入张量。

注意

黎曼ζ函数对应于 q = 1 的情况

关键字参数:

输出(张量,可选)- 输出张量。

示例::
>>> x = torch.tensor([2., 4.])
>>> torch.special.zeta(x, 1)
tensor([1.6449, 1.0823])
>>> torch.special.zeta(x, torch.tensor([1., 2.]))
tensor([1.6449, 0.0823])
>>> torch.special.zeta(2, torch.tensor([1., 2.]))
tensor([1.6449, 0.6449])

© 版权所有 PyTorch 贡献者。

使用 Sphinx 构建,主题由 Read the Docs 提供。

文档

PyTorch 开发者文档全面访问

查看文档

教程

获取初学者和高级开发者的深入教程

查看教程

资源

查找开发资源并获得您的疑问解答

查看资源