December 26, 2022
Split Custom PyTorch DataSet into Training, Testing and Validation set using random_split
PyTorchadminShuffle the list before splitting else you won’t get all the classes in the three splits since these indices would be used by the Subset class to sample from the original dataset. Shuffling the elements of a tensor amounts to finding a permutation of its indices. The random_split function does exactly this: