多个二维tensor如何整合为三维tensor?

A,B,C为[1,2]的tensor

D = torch.stack([A, B, C], dim=0)
dim代表整合的维度。即会整合成[3,1,2]的shape

你可能感兴趣的:(python)