Up to now I’ve figure out two approaches to use a custom dataset(with the standard DataLodar).
The first is to use ImageFolder, somehow  similar to creating a filelist and get access to data. Transformations such as randomcrop and scaling is convenient with that scheme,but  I guess it  is I/O-consuming.

dataset = trochvision.datasets.ImageFolder(root=‘main_dir’,transformer=torchvision.transform.Compose([…])

So the second scheme is to read in a bunch of data into the memory at a time into tensors:

dataset = torch.utils.data.TensorDataset(data_tensor,label_tensor)

Anything like the transformer in the first approach for TensorDataset？