Anything like transformer for TensorDataset?

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 =,label_tensor)

Anything like the transformer in the first approach for TensorDataset?


No, we don’t support that at the moment but it would make sense to add that. We’re going to be rewriting some transforms soon and we’ll do that then. Thanks for a suggestion!


Is transform available for TensorDataset now?

this looks like something you can integrate into.

1 Like

@apaszke any updates on adding transforms for TensorDataset?

1 Like