echo Lee
echo Lee

Reputation: 341

matrix multiplication using star operator

I am curious about what the difference is between calling torch.mm(A, B) and A*B?

Looks like torch.mm gives us the desirable result, but A*B sometimes doesn't work.

It will be better if any documentation is provided.

Thank you!

Upvotes: 3

Views: 3065

Answers (1)

Yiğit Aras Tunalı
Yiğit Aras Tunalı

Reputation: 428

torch.mm(A,B) is a regular matrix multiplication and A*B is element-wise multiplication. You can read it on this discussion. For matrix multiplication you can use @ if I am not mistaken as well.

Upvotes: 8

Related Questions