MCPcopy Create free account
hub / github.com/pytorch/pytorch / __reduce_deploy__

Method __reduce_deploy__

torch/fx/graph_module.py:746–753  ·  view source on GitHub ↗
(self, importer: Importer)

Source from the content-addressed store, hash-verified

744 # Passing Tracer as argument allows subclasses extending fx.GraphModule
745 # define their own Tracer (extending fx.Tracer).
746 def __reduce_deploy__(self, importer: Importer):
747 dict_without_graph = self.__dict__.copy()
748 dict_without_graph["_graphmodule_cls_name"] = self.__class__.__name__
749 del dict_without_graph["_graph"]
750
751 python_code = self.recompile()
752 import_block = _format_import_block(python_code.globals, importer)
753 return (reduce_deploy_graph_module, (dict_without_graph, import_block))
754
755 def __reduce_package__(self, exporter: PackageExporter):
756 dict_without_graph = self.__dict__.copy()

Callers 1

persistent_idFunction · 0.80

Calls 3

recompileMethod · 0.95
_format_import_blockFunction · 0.85
copyMethod · 0.45

Tested by

no test coverage detected