If I understood your question correctly, you have a python list and want to convert to a pytorch tensor.
python_list = [[1,2,3], [4, 5, 6]]

torch_list = torch.tensor(python_list)

Can you point out where you are getting the error in the code?