Instead of model.eval(), I have used all code inside a torch.no_grad() block. With regards to the shapes of input tensors, I checked for the correct shape beforehand and they matched correctly. Are you suggesting that there might be a problem with the values while transposing the tensor itself?