Issue
Say I have a list
of tensors, volumes
, which I can iterate over:
for volume in range(len(volumes)):
print (volume.shape)
torch.Size([3, 512, 512, 222])
<class 'torch.Tensor'>
torch.Size([3, 512, 512, 185])
<class 'torch.Tensor'>
torch.Size([3, 512, 512, 271])
<class 'torch.Tensor'>
torch.Size([3, 512, 512, 261])
<class 'torch.Tensor'>
torch.Size([3, 512, 512, 215])
<class 'torch.Tensor'>
torch.Size([3, 512, 512, 284])
<class 'torch.Tensor'>
torch.Size([3, 512, 512, 191])
<class 'torch.Tensor'>
How can I change the channel from 3 to 1, for all volumes?
Thanks
Solution
If you like just to keep the first channel for each volume, you can create a new list like that:
new_volumes = [volume[0,...] for volume in volumes]
Answered By - Ophir Yaniv
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.