convert from 3 channels to 1 channel pytorch tensor from list of tensors
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])
&lt;class 'torch.Tensor'&gt;
torch.Size([3, 512, 512, 185])
&lt;class 'torch.Tensor'&gt;
torch.Size([3, 512, 512, 271])
&lt;class 'torch.Tensor'&gt;
torch.Size([3, 512, 512, 261])
&lt;class 'torch.Tensor'&gt;
torch.Size([3, 512, 512, 215])
&lt;class 'torch.Tensor'&gt;
torch.Size([3, 512, 512, 284])
&lt;class 'torch.Tensor'&gt;
torch.Size([3, 512, 512, 191])
&lt;class 'torch.Tensor'&gt;

How can I change the channel from 3 to 1, for all volumes?
Thanks

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]

