Solved by ptrblck in post #2 
              
              
                You are creating a LongTensor of the size 1 using uninitialized memory. 
Using the “tensor type” constructors is not recommended, as it’s creating this unexpected behavior (the same applies for e.g. torch.FloatTensor). 
E.g. if you are passing a scalar value of 10 you would get a tensor with 10 unin…