I have to say it is incredible to me that this works.  so much simpler than the TF or Theano approach to the problem.  working example here:
import torch
from torch.autograd import Variable
import numpy as np
np.random.seed(20170525)
x = np.random.rand(100)
y = np.ones(100)+np.random.rand(100)
def np_mse(a,b):
    return np.mean((a-b)**2)
mse_parts = [np_mse(x.reshape(20,5)[:,i],y.copy().reshape(20,5)[:,i]) for i in range(5)]
print sum(mse_parts)
x = Variable(torch.from_numpy(x.astype('float32')),requires_grad=True)
y = Variable(torch.from_numpy(y.astype('float32')),requires_grad=True)
out = sum([torch.mean((x.view(20,5)[:,i]-y.view(20,5)[:,i])**2) for i in range(5)])
print out
out.backward() # works!!