Removes the given node from the model by replacing all of its users with the given previous node
(model: GraphModule, node: Node, prev_node: Node)
| 553 | weight_quant_obs.reset_min_max_vals() # type: ignore[operator] |
| 554 | |
| 555 | def remove_node(model: GraphModule, node: Node, prev_node: Node): |
| 556 | """ Removes the given node from the model by replacing all of its users with |
| 557 | the given previous node |
| 558 | """ |
| 559 | # For all of the current node's users, replace the current node with |
| 560 | # the input quantization observer node |
| 561 | orig_users = list(node.users.keys()) |
| 562 | for user_node in orig_users: |
| 563 | user_node.replace_input_with(node, prev_node) |
| 564 | |
| 565 | # Erase the InputEqualizationObserver node |
| 566 | model.graph.erase_node(node) |
| 567 | |
| 568 | def update_obs_for_equalization(model: GraphModule, modules: Dict[str, nn.Module]) -> Dict[str, _WeightEqualizationObserver]: |
| 569 | """ Update all of the observer's equalization scale. For each |
no test coverage detected
searching dependent graphs…