Hi,
The training session did crash when using => tranining_tensor = tranining_tensor.view(-1, 1, 69, 69)
What should I change in my CustomDataset? (see below dataloader & CustomDataset code)
See dataloader code below:
training_dataloader = DataLoader(training_ds,batch_size=100, shuffle= True)
valid_dataloader = DataLoader(validation_ds,batch_size=100, shuffle= True)
See CustomDataset code below:
from torch.utils.data import Dataset, DataLoader
class CustomDataset(Dataset):
def __init__(self, path, transform=False, mean=0.092, std=0.127, n_classes=10):

    

    self.transform = transform

    self.path = path

    self.mean = mean

    self.std = std 

    self.filelist = glob.glob(path + '/*.png')

    ##Start code##

    Temp_labels = np.zeros(len(self.filelist))

    for class_i in range(n_classes):

        Temp_labels[ np.array(['class'+str(class_i) in x for x in self.filelist]) ] = class_i

    self.labels = torch.LongTensor(Temp_labels)

    ##End code##

def __len__(self):

   

    return len(self.filelist)

def __getitem__(self, idx):

    if (self.transform):

     img = Image.open(filelist[idx])

     x = transforms.RandomRotation(180)(img) 

     x = torchvision.transforms.Normalize(mean = self.mean, std = self.std)

     x = torchvision.transforms.ToTensor()(img).view(-1)

     y = self.labels[idx]

     return x, y

    else:

     img = Image.open(filelist[idx])

     x =  torchvision.transforms.ToTensor()( img ).view(-1)

     x = (x-self.mean)/self.std

     y = self.labels[idx]

     return x, y