def __getstate__(self): state_dict = {} for k, v in self.__dict__.items(): if callable(v): state_dict[k] = serialize_fn(v) else: state_dict[k] = v return state_dict
def __getstate__(self): if IterDataPipe.getstate_hook is not None: return IterDataPipe.getstate_hook(self) state_dict = {} for k, v in self.__dict__.items(): if callable(v): state_dict[k] = serialize_fn(v) else: state_dict[k] = v return state_dict
def __getstate__(self): # TODO: Fix `dill` circular dependency - https://github.com/pytorch/data/issues/237 if DILL_AVAILABLE: state_dict = {} for k, v in self.__dict__.items(): if callable(v): state_dict[k] = serialize_fn(v) else: state_dict[k] = v return state_dict else: return self.__dict__
def __getstate__(self): if IterDataPipe.getstate_hook is not None: return IterDataPipe.getstate_hook(self) serialized_fn_with_method = serialize_fn(self.classifier_fn) state = ( self.main_datapipe, self.num_instances, self.buffer_size, serialized_fn_with_method, self.drop_none, ) return state
def __getstate__(self): if IterDataPipe.getstate_hook is not None: return IterDataPipe.getstate_hook(self) state = ( self.main_datapipe, self.num_instances, self.buffer_size, serialize_fn(self.classifier_fn) if DILL_AVAILABLE else self.classifier_fn, self.drop_none, ) return state