Solved by tom in post #2 
              
              
                For PyTorch you would need to use nested stacks or a for loop 
t = torch.stack([torch.stack([torch.stack(l2, dim=0) for l2 in l1], dim=0) for l1 in a], dim=0)

or somesuch (I might have gotten the brackets wrong). But this will copy the tensors several times, so an alternative is just allocate and c…