MCPcopy Create free account
hub / github.com/pytorch/executorch / add

Method add

backends/arm/debug/schema.py:119–142  ·  view source on GitHub ↗
(self, node: torch.fx.Node, tosa_op: Any, tosa_op_id: ts.Op)

Source from the content-addressed store, hash-verified

117 self.mode = debug_mode
118
119 def add(self, node: torch.fx.Node, tosa_op: Any, tosa_op_id: ts.Op) -> DebugSchema:
120 tosa_debug_info = None
121
122 # If the debug data is being embedded into the TOSA flatbuffer
123 # do not collect TOSADebugSchema data, it's redundent
124 if self.mode != ArmCompileSpec.DebugMode.TOSA:
125 tosa_debug_info = TosaDebugSchema(
126 node_name=str(tosa_op),
127 operator_name=str(tosa_op_id),
128 operator_id=int(tosa_op_id),
129 )
130
131 aten_debug_info = ATenDebugSchema.from_node(node)
132 torch_debug_info = TorchDebugSchema.from_node(node)
133
134 debug_info = DebugSchema(
135 event_id=len(self._debug_events),
136 aten_info=aten_debug_info,
137 tosa_info=tosa_debug_info,
138 torch_info=torch_debug_info,
139 )
140 self._debug_events.append(debug_info)
141
142 return debug_info
143
144 def serialize(self) -> str:
145 return json.dumps([event.to_dict() for event in self._debug_events], indent=4)

Callers 15

test_debug_hook_add_jsonFunction · 0.95
test_debug_hook_add_tosaFunction · 0.95
forwardMethod · 0.45
forwardMethod · 0.45
forwardMethod · 0.45
forwardMethod · 0.45
forwardMethod · 0.45
forwardMethod · 0.45
forwardMethod · 0.45
forwardMethod · 0.45
forwardMethod · 0.45
forwardMethod · 0.45

Calls 4

TosaDebugSchemaClass · 0.85
DebugSchemaClass · 0.85
from_nodeMethod · 0.45
appendMethod · 0.45

Tested by 15

test_debug_hook_add_jsonFunction · 0.76
test_debug_hook_add_tosaFunction · 0.76
forwardMethod · 0.36
forwardMethod · 0.36
forwardMethod · 0.36
forwardMethod · 0.36
forwardMethod · 0.36
gen_test_case_op_addFunction · 0.36
forwardMethod · 0.36
forwardMethod · 0.36
test_fp32_rsqrtMethod · 0.36
forwardMethod · 0.36