(root /*, concrete_args */)
| 8707 | }); |
| 8708 | this.registerType('torch.fx._symbolic_trace.Tracer', class extends torch.fx.proxy.TracerBase { |
| 8709 | trace(root /*, concrete_args */) { |
| 8710 | let fn = null; |
| 8711 | if (root instanceof torch.nn.Module) { |
| 8712 | // torch.fx._lazy_graph_module._LazyGraphModule.force_recompile(root) |
| 8713 | this.root = root; |
| 8714 | fn = builtins.getattr(new builtins.type(root), this.traced_func_name); |
| 8715 | this.root_module_name = root._get_name(); |
| 8716 | this.submodule_paths = new builtins.dict(root.named_modules()); |
| 8717 | } else { |
| 8718 | this.root = new torch.nn.Module(); |
| 8719 | fn = root; |
| 8720 | } |
| 8721 | const tracer_cls = builtins.getattr(this, '__class__', null); |
| 8722 | this.graph = new torch.fx.graph.Graph(null, tracer_cls); |
| 8723 | if (builtins.hasattr(this, '__code__')) { |
| 8724 | const code = fn.__code__; |
| 8725 | this.graph._co_fields = { |
| 8726 | co_name: code.co_name, |
| 8727 | co_filename: code.co_filename, |
| 8728 | co_firstlineno: code.co_firstlineno, |
| 8729 | }; |
| 8730 | } |
| 8731 | return this.graph; |
| 8732 | } |
| 8733 | is_leaf_module(m /*, module_qualified_name */) { |
| 8734 | return (m.__module__.startsWith('torch.nn') || m.__module__.startsWith('torch.ao.nn')) && m instanceof torch.nn.Sequential === false; |
| 8735 | } |
no test coverage detected