Dataloader resets dataset state

Thanks for the quick reply.

Your code illustrates the problem.

The caching is simple, I’m just filling in a list (an attribute of my dataset class) with the data items as they become computed in __getitem__ (let me know if this is not clear enough).

At the moment I think I’ll just work around by computing all the items in __init__, though my initial thought was that I shouldn’t have to. It would be nice if new workers would not be created in the second data iteration (i.e. the last loop above), or that each new worker would get an updated copy of the dataset if new ones have to be created.