Solved by rasbt in post #2 
              
              
                [1 , 2 ,[3, 4], 5] can not be converted correctly. 

Well, it’s not a symmetric shape. it’s impossible to have a matrix that has a different number of elements in each row – it doesn’t exist. You can cast this into a vector though if that’s desired: 
your_list = [1 , 2 ,[3, 4], 5] 

torch.tensor(li…