Torch 运算符 @ 和 *

'@' : 矩阵乘
'*' : 矩阵点乘

>>a = torch.tensor([[1, 2],
                   [3, 4]])
>>b = torch.tensor([[4, 5],
                    [6, 7]])
>>print(f'a x b = {a @ b}\na * b = {a * b}')

>>a x b = tensor([[16, 19],
                  [36, 43]])
  a * b = tensor([[ 4, 10],
                  [18, 28]])
posted @ 2022-01-10 11:17  小艾衰  阅读(1418)  评论(0编辑  收藏  举报