Commit 222a8dbd authored by Samuel GAIST's avatar Samuel GAIST

[data_loaders] Make DataLoader pickable

This will allow to pass an instance of it in
a queue when using the multiprocessing module.
parent 5187681a
......@@ -310,6 +310,17 @@ class DataLoader(object):
return (result, indices[0], indices[1])
def __getstate__(self):
state = self.__dict__.copy()
#  reset the data cached as its content is not pickable
for infos in state["infos"].values():
infos["data"] = None
infos["start_index"] = -1
infos["end_index"] = -1
return state
# ----------------------------------------------------------
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment