| 19838 | this.module = new torch.nn.Module(); |
| 19839 | } |
| 19840 | save_graph_module() { |
| 19841 | const Context = class { |
| 19842 | constructor(self) { |
| 19843 | this.self = self; |
| 19844 | } |
| 19845 | __enter__() { |
| 19846 | this.saved = [ |
| 19847 | this.self.graph, |
| 19848 | this.self.module, |
| 19849 | this.self.serialized_name_to_node, |
| 19850 | this.self.serialized_name_to_meta, |
| 19851 | this.self.unbacked_symbols, |
| 19852 | ]; |
| 19853 | this.self.graph = new torch.fx.graph.Graph(); |
| 19854 | this.self.module = new torch.nn.modules.module.Module(); |
| 19855 | this.self.serialized_name_to_node = new builtins.dict(); |
| 19856 | this.self.serialized_name_to_meta = new builtins.dict(); // torch._export.serde.serialize.LazyMap |
| 19857 | this.self.unbacked_symbols = new Set(); |
| 19858 | } |
| 19859 | __exit__(/* exc_type, exc_value, traceback */) { |
| 19860 | const self = this.self; |
| 19861 | [self.graph, self.module, self.serialized_name_to_node, self.serialized_name_to_meta, self.unbacked_symbols] = this.saved; |
| 19862 | } |
| 19863 | }; |
| 19864 | return new Context(this); |
| 19865 | } |
| 19866 | deserialize_graph_output(output) { |
| 19867 | if (output.type === 'as_tensor') { |
| 19868 | return this.serialized_name_to_node.__getitem__(output.as_tensor.name); |