Solved by ptrblck in post #2 
              
              
                Removing all internal self.samples should work, as the DatasetFolder class uses this attribute to get the length as seen here. 
Alternatively, you could also try to monkey-patch the __len__(self) method and assign the desired value to it, assuming you want to reduce the number of samples and remove …