Dataset function that is called on every epoch

Is there a function in dataset that is called on every epoch by the dataloader? I want to be able to reset some variables that i am using to maintain statistics.

Since DataLoader takes an instance of Dataset, I think it is not possible to do programmatically manipulate the dataset. Recreating the Dataset should be the way to go.

To make it a bit efficient, I would create an instance of the processed content that can be directly used by a new dataset that you create every epoch. And have your logic of manipulating the data in the get_item method. This way there shouldn’t be much overhead.