Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

What is the multiplication of Pytorch?

Shulou Source: shulou.com Published: 2022-06-01 17:51:09 09月27日 Update

What is the multiplication of Pytorch? in view of this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible way.

A = torch.tensor ([[1,2,3], [1,2,3]]) b = torch.tensor ([[1,1,1], [2,2,2], [3,3,3]]) c = a * bd = torch.mm (a, b) print (a) print (b) print (c) print (d)

Element correspondence multiplication: either directly with * or torch.mul (a, b)

Matrix multiplication: torch.mm (aformab) this method is only suitable for two-dimensional matrices, and torch.matmul (aformab) recommends this method.

The dot multiplication of one-dimensional tensor: torch.dot (afield b) is a dot product operation for two 1D tensors.

The answer to the question about the multiplication of Pytorch is shared here. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel to learn more about it.

Tags: Questions multiplication tensors more this method matrix help solution easy easy two elements content guys partners methods knowledge articles industry information Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi vpn MariaDB MySQL Docker