加减乘除
矩阵相乘
torch.mm 只适用于2d,不推荐
torch.matmul 推荐使用
@ 运算符重载
次方运算
a = torch.full([2,2],3)
aa = a.pow(2)
操作运算如下:
a.pow(n)
表示an
a**n
表示an
aa.sqrt()
表示aa 1/2
aa.rsqrt()
表示aa1/3
注意这里没有torch.
torch.mm 只适用于2d,不推荐
torch.matmul 推荐使用
@ 运算符重载
a = torch.full([2,2],3)
aa = a.pow(2)
操作运算如下:
a.pow(n)
表示an
a**n
表示an
aa.sqrt()
表示aa 1/2
aa.rsqrt()
表示aa1/3
注意这里没有torch.