1313
1414import logging
1515import os
16- from typing import final , List , Optional
16+ from typing import cast , final , List , Optional
1717
1818import serializer .tosa_serializer as ts
1919from executorch .backends .arm .arm_vela import vela_compile
3232from executorch .exir .backend .backend_details import BackendDetails , PreprocessResult
3333from executorch .exir .backend .compile_spec_schema import CompileSpec
3434from torch .export .exported_program import ExportedProgram
35+ from torch .fx import Node
3536
3637# TOSA backend debug functionality
3738logger = logging .getLogger (__name__ )
@@ -269,6 +270,7 @@ def preprocess( # noqa: C901
269270 node_visitors = get_node_visitors (edge_program , tosa_spec )
270271 input_count = 0
271272 for node in graph_module .graph .nodes :
273+ node = cast (Node , node )
272274 if node .op == "call_function" :
273275 process_call_function (node , tosa_graph , node_visitors , tosa_spec )
274276 elif node .op == "placeholder" :
@@ -288,9 +290,6 @@ def preprocess( # noqa: C901
288290 "The rank of the input order is not equal to amount of input tensors"
289291 )
290292
291- # TODO: It would be awesome if this dump could somehow be done on top level and not here.
292- # Problem is that the desc.json has to be created on the tosa_graph object, which we can't
293- # access from top level.
294293 if artifact_path :
295294 tag = _get_first_delegation_tag (graph_module )
296295 dbg_tosa_dump (
@@ -311,6 +310,4 @@ def preprocess( # noqa: C901
311310 else :
312311 raise RuntimeError (f"Unknown format { output_format } " )
313312
314- # Continueing from above. Can I put tosa_graph into this function?
315- # debug_handle_map = ...
316313 return PreprocessResult (processed_bytes = binary )
0 commit comments