In this MR, some bugs related to PyTorch models are fixed and improved:
to(device)
model.eval()
torch.no_grad()