torch.stack should do the job for this.


torch.stack(sequence, dim=0)
Concatenates sequence of tensors along a new dimension.
All tensors need to be of the same size.
Parameters:	
sequence (Sequence) – sequence of tensors to concatenate.
dim (int) – dimension to insert. Has to be between 0 and the number of dimensions of concatenated tensors (inclusive).