After an update, some parts of my code don’t work anymore.
I have a tensor X of size 64 * 1 * 3 * 3 and a tensor Y of size 1 * 3 * 3, and I want to make the coeff-wise multiplication Z = X * Y. It would be equivalent to:

Z = X.new().resize_as_(X)
for i in range(64):
Z[i] = X[i] * Y

Is the solution Z = X * Y.unsqueeze(0).expand_as(X) efficient? Is there a better way to do it?

Traceback (most recent call last):
File "main.py", line 13, in <module>
c = a * b
File ".../python3.6/site-packages/torch/tensor.py", line 283, in __mul__
return self.mul(other)
RuntimeError: inconsistent tensor size at ...

The problem was: I never updated anaconda and when I “updated” pytorch with conda install pytorch torchvision -c pytorch, it was downgraded…
I just had to update anaconda and reinstall pytorch.