My data is not distributed in train and test directories but only in classes. I mean:
image-folders/
   ├── class_0/
   |   ├── 001.jpg
   |   ├── 002.jpg
   └── class_1/
   |   ├── 001.jpg
   |   └── 002.jpg
   └── class_2/
       ├── 001.jpg
       └── 002.jpg

Is it the right way to approach the problem (What this does is: take datafolder and than divide it into train, valid and test sets. However, i am worried if it is the samething as valid/dev set even though “test set” will not go through training and validation loop):
    data = datasets.ImageFolder('PATH', transform)
    indices = list(range(len(data)))
    np.random.shuffle(indices)
    split = int(np.floor(valid_size * len(data)))
    train_idx, valid_idx = indices[split:], indices[:split]

    split = int(np.floor(test_size * len(valid_idx)))
    valid_idx, test_idx = indices[split:], indices[:split]

# define samplers for obtaining training and validation and test batches
    train_sampler = SubsetRandomSampler(train_idx)
    valid_sampler = SubsetRandomSampler(valid_idx)
    test_sampler = SubsetRandomSampler(test_idx)

# prepare data loaders (combine dataset and sampler)
    train_loader = torch.utils.data.DataLoader(data, batch_size=batch_size, sampler=train_sampler, num_workers=num_workers)
    valid_loader = torch.utils.data.DataLoader(data, batch_size=batch_size, sampler=valid_sampler, num_workers=num_workers)
    test_loader = torch.utils.data.DataLoader(data, batch_size=batch_size, sampler=test_sampler  num_workers=num_workers)