Hello,
I extracted the image patches and wrote dataloader for GANs.
But Now I get errors as follows.I dont understand where I am  going wrong with my understanding. I split the data afterwards. Although I know that we do it before dataloader. If that is the case, when I extract the patches , should I split the data after that?
I am trying to implement eriklindernoren/ **[PyTorch-GAN] cycle gan implementation. for my own dataset. In all the GANs example and implementation, the datasets are already saved in directories for train and testing. So I am have hard time to understand how should I do it my dataset after preprocessing.
In my dataprocessing file after I extracted the patches
patch_A = extract_patches(torch.tensor(ct_numpy))  >>torch.Size([112, 64, 64, 64])
patch_B =extract_patches(torch.tensor(pet_numpy))  >>torch.Size([112, 64, 64, 64])
In dataloader :
class MyDataset(Dataset) :
def init(self , patch_A, patch_B):
‘characterizes a dataset for pytorch’
self.patch_A = patch_A
self.patch_B = patch_B
self.transforms = transforms.ToTensor
 def __len__(self):
    'denotes the total number of samples'
    return len(self.patch_B) , len(self.patch_A)

 def __getitem__(self,index):
    'Generates one sample of data'
    #select sample
    x = self.patch_A[0]
    y = self.patch_B[0]
    
    return x,y

train_A_dataset = torch.utils.data.random_split(patch_A ,(0.7*len(patch_A)))
train_B_dataset =torch.utils.data.random_split(patch_B ,(0.7*len(patch_B)))
test_A_dataset =torch.utils.data.random_split(patch_A ,(len(patch_A)-len(train_A_dataset)))
test_B_dataset =torch.utils.data.random_split(patch_B ,(0.7*len(patch_B))-len(train_B_dataset))
It gives the error:
Traceback (most recent call last):
File “E:/example/DataLoader.py”, line 28, in 
train_A_dataset = torch.utils.data.random_split(patch_A ,(0.7*len(patch_A)))
File “C:\Users\Anaconda3\lib\site-packages\torch\utils\data\dataset.py”, line 271, in random_split
if sum(lengths) != len(dataset):
TypeError: ‘float’ object is not iterable