m1 : [a x b]
m2 : [a x c]
and I want to make a new matrix with shape
m3 : [a x d]
where d = b*c.
i.e, the new matrix column-wisely multiply m1 with m2.
Which can I use?
m1 : [a x b]
m2 : [a x c]
and I want to make a new matrix with shape
m3 : [a x d]
where d = b*c.
i.e, the new matrix column-wisely multiply m1 with m2.
Which can I use?
I’m not sure, if I understand the use case correctly, but could you check, if this code snippet would work for you:
a, b, c = 2, 3, 4
x = torch.randn(a, b)
y = torch.randn(a, c)
z = torch.matmul(x.unsqueeze(2), y.unsqueeze(1))
z = z.view(a, -1)
If not, could you provide dummy tensors and the expected result?
This command works for me. Thanks!