Hi,
1. yes, I haven’t used the reshape operation at that time.
2. I am curious why have you included np.random.randn ?
The CT and MR patch centers come from the exact same location from two images. I mean the patches must be paired.
Won’t np.random.randn change the correspondence of patches in CT and MR based on random.seed()?
3. I have used reshape in the following way:
patches_MR = np.array(patches_MR)
patches_MR = patches_MR.reshape(-1,32,32,32) #todo: which formats
patches_CT = np.array(patches_CT)
patches_CT = patches_CT.reshape(-1,32,32,32)
# patches_MR = np.array(patches_MR) #type(patches_MR) -->  numpy.ndarray

train_dataset = Dataset(patches_MR,patches_CT)
train_loader = data.DataLoader(train_dataset,batch_size=5,shuffle=True)
print('train directory has {} samples'.format(len(train_dataset)))
# train directory has 9000 samples


for i,sample in enumerate(train_loader):
    mr = sample[0].float().to(device) 
    print('input sample shape of train_loader: {}'.format(mr.shape))
    #input sample shape of train_loader: torch.Size([5, 1, 32, 32, 32])
#    input sample shape of train_loader: torch.Size([5, 1, 32, 32, 32])
#    input sample shape of train_loader: torch.Size([5, 1, 32, 32, 32])
.
.
.


Now it works as you have suggested I guess.
4. Its funny coz I also don’t know how it worked at that time:
# np.shape(train_dataset) 
# Out[242]: (18, 2, 500, 32, 32, 32)

but later it showed errors and I have corrected it as you have mentioned.
I have the following question:
5.  Is it necessary to use the class Dataset and torch.utils.data.DataLoader to input the data to the network??
I have seen PyTorch codes that do not use these two either.