Nikhil_Pinnaparaju:

return torch.tensor(outputs).cuda()


This should have gotten you
UserWarning: To copy construct from a tensor, it is recommended to use sourceTensor.clone().detach() or sourceTensor.clone().detach().requires_grad_(True), rather than torch.tensor(sourceTensor).

Of course, you actually want to do something entirely differen, namely you should use torch.stack there.
I would also recommend to revisit using the use of Variable, it was deprecated with PyTorch 0.4 a year and a half ago 8.
Best regards
Thomas