Solved by ptrblck in post #2 
              
              
                The new_tensor is being created on the default device, while the model and data could be on another device using nn.DataParallel. 
If you need to create new tensors inside your forward method, you should push them to the current device your model and data is on, e.g.: 
new_tensor = torch.tensor([1.0…