"inconsistent tensor size" when the Tensors are broadcast-able in numpy!


So my pdb output says it all but just to be clear:
I am trying to mul two Tensors. According to the documentation here this should work:

I’ve tried + too and the same error. So that makes me confused…otherwise the framework is really the best I’ve seen so far.

So…I’m confused. Is broadcasting not supported yet, even though it appears on the documentation? when will it be supported? What should I do in the mean time? I know that I can use Act_weights.expand_as(Act) but that seems a bit awkward code-wise :stuck_out_tongue: Also, there are other solutions which seem to rely even more on the underlying code so i wonder if that solution is slow…

Thanks in advance!

(Pdb) Act
Variable containing:
 0.0000  0.7156
 0.0000  0.7219
 0.0000  3.1095
[torch.FloatTensor of size 3x2]

(Pdb) Act_weights
Variable containing:
 0.5000  0.5000
[torch.FloatTensor of size 1x2]

(Pdb) Act.size()
torch.Size([3, 2])
(Pdb) Act_weights.size()
torch.Size([1, 2])
(Pdb) Act*Act_weights
*** RuntimeError: inconsistent tensor size at /b/wheel/pytorch-src/torch/lib/TH/generic/THTensorMath.c:846
(Pdb) Act.data.numpy()*Act_weights.data.numpy()
array([[ 0.        ,  0.35781485],
       [ 0.        ,  0.3609345 ],
       [ 0.        ,  1.5547576 ]], dtype=float32)

It will be possible soon:

yeah、it confused me now!、but my other colleague can do this… maybe my version is old