Solved by tom in post #2 
              
              
                The problem is in the Python. The torch.Tensor constructor has been deprecated in PyTorch 0.4 or so. The new way is using torch.tensor instead, and that has an equivalent in C++.