Interstingly np.mean() works but np.std() does NOT work.  Any insight into why?
Looks like the variable that comes back has a strange format:
out = np.std([torch.mean((x.view(20,5)[:,i]-y.view(20,5)[:,i])**2) for i in range(5)])

0.149130464538 [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[Variable containing: 0.1491 [torch.FloatTensor of size 1] ]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]] Traceback (most recent call last): File "pytorch_customloss.py", line 17, in <module> out.backward() # works!! AttributeError: 'numpy.ndarray' object has no attribute 'backward'