I am trying to get a matrix vector multiply over a batch of vector inputs.
Given:
# (batch x inp)
v = torch.randn(5, 15)
# (inp x output)
M = torch.randn(15, 20)

Compute:
# (batch x output)
out = torch.Tensor(5, 20)
for i, batch_v in enumerate(v):
    out[i] = (batch_v * M).t()

But (i) multiplication seems to expect both inputs with equal dimensions resulting in a RuntimeError: inconsistent tensor size at /home/enrique/code/vendor/pytorch/torch/lib/TH/generic/THTensorMath.c:623, and (2) I’d be cool if I didn’t have to loop over row vectors.