In the training function:
where you have written:
inputs, labels = data
inputs, labels = Variable(inputs), Variable(labels)
add this:
labels=labels[:,0]
The error is because the labels are of size batch_sizex1 you need to convert it to 'batch_size'