MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / __setstate__

Method __setstate__

imperative/python/megengine/traced_module/expr.py:583–595  ·  view source on GitHub ↗
(self, state)

Source from the content-addressed store, hash-verified

581 return state
582
583 def __setstate__(self, state):
584 # compat with mge 1.6
585 if "opdef" in state and "opdef_state" not in state:
586 opdef_state = state.pop("opdef")
587 opdef_state["opdef_type"] = opdef_state.pop("type")
588 state["opdef_state"] = opdef_state
589 self.__dict__.update(state)
590 assert isinstance(state["opdef_state"], dict)
591 opdef_state = state["opdef_state"].copy()
592 opdef_type = opdef_state.pop("opdef_type")
593 opdef_obj = opdef_type()
594 opdef_obj.__setstate__(opdef_state)
595 setattr(self, "opdef", opdef_obj)
596
597 @classmethod
598 def apply_module_trace_hook(cls, opdef, *inputs):

Callers 2

to_moduleMethod · 0.45
load_apply_exprFunction · 0.45

Calls 2

updateMethod · 0.45
copyMethod · 0.45

Tested by

no test coverage detected