【pytorch】pytorch维度变换函数:cat, stack, transpose, permute, unsqueeze, squeeze
Talkischeap,Showmethecodecatcat用于将两个tensor在某个维度上拼接起来除了要拼接的维度,这两个tensor其它维度的大小应该一致importtorchtorch.manual_seed(666)x1=torch.randn(3,5)x2=torch.randn(4,5)x_cat=torch.cat((x1,x2),0)#将x1和x2在第0个维度上拼接print(