pytorch/torch/ao/quantization/pt2e/numeric_debugger.py
Jerry Zhang b893aa71ca Rename generate_numeric_debug_handle to numeric_debugger (#130590)
Summary:
att

Test Plan:
CI

Reviewers:

Subscribers:

Tasks:

Tags:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/130590
Approved by: https://github.com/dulinriley, https://github.com/tarun292
2024-07-15 22:42:27 +00:00

14 lines
460 B
Python

from torch.fx import GraphModule
__all__ = ["generate_numeric_debug_handle", "NUMERIC_DEBUG_HANDLE_KEY"]
NUMERIC_DEBUG_HANDLE_KEY = "_numeric_debug_handle"
def generate_numeric_debug_handle(graph_module: GraphModule) -> None:
unique_id = 0
for node in graph_module.graph.nodes:
if node.op != "placeholder" and NUMERIC_DEBUG_HANDLE_KEY not in node.meta:
node.meta[NUMERIC_DEBUG_HANDLE_KEY] = unique_id
unique_id += 1