Here’s the output to the code you requested
<class 'torch.autograd.variable.Variable'>
<class 'torch.autograd.variable.Variable'>
Label:Variable containing:
 5
 6
 6
 6
[torch.cuda.LongTensor of size 4 (GPU 0)]

The error is thrown on the optimizer.step() line, here’s the full error code:
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-67-d9149eef4ecc> in <module>()
     30         #loss = criterion(outputs, labels)
     31         loss.backward()
---> 32         optimizer.step()
     33 
     34         # print statistics

~/anaconda2/envs/pytorch/lib/python3.5/site-packages/torch/optim/sgd.py in step(self, closure)
     90                     else:
     91                         buf = param_state['momentum_buffer']
---> 92                         buf.mul_(momentum).add_(1 - dampening, d_p)
     93                     if nesterov:
     94                         d_p = d_p.add(momentum, buf)

TypeError: add_ received an invalid combination of arguments - got (int, torch.cuda.FloatTensor), but expected one of:
 * (float value)
 * (torch.FloatTensor other)
 * (torch.SparseFloatTensor other)
 * (float value, torch.FloatTensor other)
      didn't match because some of the arguments have invalid types: (int, !torch.cuda.FloatTensor!)
 * (float value, torch.SparseFloatTensor other)
      didn't match because some of the arguments have invalid types: (int, !torch.cuda.FloatTensor!)