Attach a `DeQuantStub` to the model and create a node that calls this `DeQuantStub` on the output of `node`, similar to how observers are inserted.
(
node: Node,
model: torch.nn.Module,
named_modules: Dict[str, torch.nn.Module],
graph: Graph,
)
| 500 | return None |
| 501 | |
| 502 | def _insert_dequant_stub( |
| 503 | node: Node, |
| 504 | model: torch.nn.Module, |
| 505 | named_modules: Dict[str, torch.nn.Module], |
| 506 | graph: Graph, |
| 507 | ) -> Node: |
| 508 | """ |
| 509 | Attach a `DeQuantStub` to the model and create a node that calls this |
| 510 | `DeQuantStub` on the output of `node`, similar to how observers are inserted. |
| 511 | """ |
| 512 | prefix = "dequant_stub_" |
| 513 | get_new_dequant_stub_name = get_new_attr_name_with_prefix(prefix) |
| 514 | dequant_stub_name = get_new_dequant_stub_name(model) |
| 515 | dequant_stub = DeQuantStub() |
| 516 | setattr(model, dequant_stub_name, dequant_stub) |
| 517 | named_modules[dequant_stub_name] = dequant_stub |
| 518 | with graph.inserting_after(node): |
| 519 | return graph.call_module(dequant_stub_name, (node,)) |
| 520 | |
| 521 | def _insert_dequant_stubs_for_custom_module_lstm_output( |
| 522 | node: Node, |
no test coverage detected
searching dependent graphs…