import torch
a = torch.rand(3,6,9)
size = a.shape
for i in range(size[0]) # 通道数取值
print(a[i,:,:].view(6,9))
三维tensor,按通道数取出二维tensor
最新推荐文章于 2024-04-01 17:15:07 发布
import torch
a = torch.rand(3,6,9)
size = a.shape
for i in range(size[0]) # 通道数取值
print(a[i,:,:].view(6,9))