Solved by Hong in post #2 
              
              
                You can do something like: 
a = [[1,3],[1,2,3]]
tensors = []
for l in a:
    tensors.append(torch.zeros(4).scatter_(0, torch.tensor(l), 1))
result = torch.stack(tensors, 0)