当前位置:主页 > 软件编程 > Python代码 >

pytorch点乘与叉乘示例讲解

时间:2021-04-05 10:11:10 | 栏目:Python代码 | 点击:

点乘

import torch
x = torch.tensor([[3,3],[3,3]])
y = x*x #x.dot(x)
z = torch.mul(x,x) #x.mul(x)
print(y)
print(z)

叉乘

import torch
x = torch.tensor([[3,3],[3,3]])
y = torch.mm(x,x) #x.mm(x)
print(y)

您可能感兴趣的文章:

相关文章