I encountered a similar error where the forward pass was OK and backward failed. I compiled the latest version and can reproduce your error. My traceback is as follows, which is a little different from yours:
Traceback (most recent call last):
File “try.py”, line 31, in 
loss.backward()
File “/home/qizhe/tool/anaconda2/lib/python2.7/site-packages/torch/autograd/variable.py”, line 152, in backward
torch.autograd.backward(self, gradient, retain_graph, create_graph, retain_variables)
File “/home/qizhe/tool/anaconda2/lib/python2.7/site-packages/torch/autograd/init.py”, line 98, in backward
variables, grad_variables, retain_graph)
File “/home/qizhe/tool/anaconda2/lib/python2.7/site-packages/torch/autograd/function.py”, line 91, in apply
return self._forward_cls.backward(self, *args)
File “/home/qizhe/tool/anaconda2/lib/python2.7/site-packages/torch/autograd/_functions/pointwise.py”, line 289, in backward
return grad_output * mask, None
File “/home/qizhe/tool/anaconda2/lib/python2.7/site-packages/torch/autograd/variable.py”, line 802, in mul
return self.mul(other)
File “/home/qizhe/tool/anaconda2/lib/python2.7/site-packages/torch/autograd/variable.py”, line 311, in mul
return Mul.apply(self, other)
File "/home/qizhe/tool/anaconda2/lib/python2.7/site-packages/torch/autograd/functions/basic_ops.py", line 48, in forward
return a.mul(b)
RuntimeError: inconsistent tensor size, expected r [1 x 100 x 6 x 6], t [1 x 100 x 6 x 6] and src [64 x 100] to have the same number of elements, but got 3600, 3600 and 6400 elements respectively at /home/qizhe/tool/pytorch/torch/lib/TH/generic/THTensorMath.c:875