(
self,
serialized_graph_module: GraphModule,
symbol_name_to_range: Optional[Dict[str, symbolic_shapes.ValueRanges]] = None,
constants: Optional[Dict[str, Any]] = None,
)
| 1263 | ) |
| 1264 | |
| 1265 | def deserialize( |
| 1266 | self, |
| 1267 | serialized_graph_module: GraphModule, |
| 1268 | symbol_name_to_range: Optional[Dict[str, symbolic_shapes.ValueRanges]] = None, |
| 1269 | constants: Optional[Dict[str, Any]] = None, |
| 1270 | ) -> Result: |
| 1271 | self.shape_env = symbolic_shapes.ShapeEnv(assume_static_by_default=True) |
| 1272 | self.fake_tensor_mode = FakeTensorMode( |
| 1273 | allow_fallback_kernels=False, |
| 1274 | allow_non_fake_inputs=True, |
| 1275 | shape_env=self.shape_env, |
| 1276 | ) |
| 1277 | self.symbol_name_to_symbol: Dict[str, sympy.Symbol] = {} |
| 1278 | self.symbol_name_to_range = {} if symbol_name_to_range is None else symbol_name_to_range |
| 1279 | self.constants = {} if constants is None else constants |
| 1280 | |
| 1281 | self.deserialize_graph(serialized_graph_module.graph) |
| 1282 | |
| 1283 | sig = self.deserialize_signature(serialized_graph_module.signature) |
| 1284 | module_call_graph = self.deserialize_module_call_graph(serialized_graph_module.module_call_graph) |
| 1285 | return GraphModuleDeserializer.Result( |
| 1286 | graph_module=torch._export.exported_program._create_graph_module_for_export(self.module, self.graph), |
| 1287 | signature=sig, |
| 1288 | module_call_graph=module_call_graph, |
| 1289 | names_to_symbols=self.symbol_name_to_symbol, |
| 1290 | ) |
| 1291 | |
| 1292 | def sync_fx_node(self, name: str, fx_node: torch.fx.Node): |
| 1293 | if name in self.serialized_name_to_node: |
no test coverage detected