Solved by ptrblck in post #2 
              
              
                This won’t work, as your input has varying shapes in dim1. 
You could pad the last row with some values: 
a = [[1,2,3],[4,5,6],[1, 0, 0]]
b = torch.tensor(a)