I have a tensor of size [1,3,224,224]
and want to divide into 3 different tensors each of size [1,1,224,224]
.
I have tried using this snippet :
for c in range(x.shape[1]):
torch.save(x[:, c:c+1, ...], f'channel{c}.pth')
I have a tensor of size [1,3,224,224]
and want to divide into 3 different tensors each of size [1,1,224,224]
.
I have tried using this snippet :
for c in range(x.shape[1]):
torch.save(x[:, c:c+1, ...], f'channel{c}.pth')
Your code snippet should work and would save 3 tensors each in the shape of [1, 1, 224, 224]
. Are you seeing any issues?