The title of your publication挨打

Page 66

-0.3052 -0.3111 -0.1809 0.0000

0.0064 -1.6250

[torch.FloatTensor of size 3x3]

BLAS and LAPACK Operations torch.addbmm torch.addbmm(beta=1, mat, alpha=1, batch1, batch2, out=None) → Tensor 对两个批 batch1 和 batch2 内存储的矩阵进行批矩阵乘操作,附带 reduced add 步骤( 所有矩阵 乘结果沿着第一维相加)。矩阵 mat 加到最终结果。 batch1 和 batch2 都为包含相同数量矩阵的 3 维张量。 如果 batch1 是形为 b×n×m 的张量,batch1 是形为 b×m×p 的张量,则 out 和 mat 的形状 都是 n×p,即 res=(beta∗M)+(alpha∗sum(batch1i@batch2i,i=0,b)) 对类型为 FloatTensor 或 DoubleTensor 的输入,alphaand beta 必须为实数,否则两个参数须为 整数。 参数:

 beta (Number, optional) – 用于 mat 的乘子  mat (Tensor) – 相加矩阵  alpha (Number, optional) – 用于 batch1@batch2batch1@batch2 的乘子  batch1 (Tensor) – 第一批相乘矩阵  batch2 (Tensor) – 第二批相乘矩阵  out (Tensor, optional) – 输出张量 例子: >>> M = torch.randn(3, 5) >>> batch1 = torch.randn(10, 3, 4) >>> batch2 = torch.randn(10, 4, 5) >>> torch.addbmm(M, batch1, batch2) -3.1162 1.8265 -9.3387

11.0071 6.0739 -0.1794

7.3102

0.1824

0.4589

-0.5641

-1.2318 -6.8841

-7.6892 -5.4283 -4.7239

[torch.FloatTensor of size 3x5]

torch.addmm torch.addmm(beta=1, mat, alpha=1, mat1, mat2, out=None) → Tensor 对矩阵 mat1 和 mat2 进行矩阵乘操作。矩阵 mat 加到最终结果。如果 mat1 是一个 n×m 张 量,mat2 是一个 m×p 张量,那么 out 和 mat 的形状为 n×p。 alpha 和 beta 分别是两个矩 阵 mat1@mat2 和 mat 的比例因子, 即, out=(beta∗M)+(alpha∗mat1@mat2) 对类型为 FloatTensor 或 DoubleTensor 的输入,betaand alpha 必须为实数,否则两个参数须为 整数。 参数 :

 beta (Number, optional) – 用于 mat 的乘子  mat (Tensor) – 相加矩阵  alpha (Number, optional) – 用于 mat1@mat2mat1@mat2 的乘子  mat1 (Tensor) – 第一个相乘矩阵


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.