The error, I replied above with:
RuntimeError: Expected object of scalar type Long but got scalar type Double for argument #2 'target' in call to _thnn_nll_loss_forward

was resolved by converting both the arguments that loss criterion needed, outputs and batch_y, to torch type long tensors. By changing the code from:
 outputs = pytorch_model(batch_x.double())
 loss = criterion(outputs, batch_y)

to
 outputs = pytorch_model(batch_x.double()).long()
 loss = criterion(outputs, batch_y.long())

And now, it gives this error:
RuntimeError: "log_softmax_lastdim_kernel_impl" not implemented for 'Long'

How can I resolve this?