You may want to use torch.stack and torch.squeeze in conjunction. The first converts a list of tensors to a single stacked tensor, and the latter removes all dimensions=1, thus making your data compact.