mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
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
14 lines
460 B
Python
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
|