It is a problem on how numpy multiplication is done unfortunately, because you do b*x, it is numpy implementation that is used. You can try doing x*b and it should fail with a nice error message from pytorch.