1515 get_param_tensor ,
1616 is_param_node ,
1717)
18+ from executorch .backends .arm .constants import DQ_OPS , Q_OPS
1819
19- from executorch .backends .arm .tosa_quant_utils import dq_ops , q_ops , QuantArgs
20+ from executorch .backends .arm .tosa_quant_utils import QuantArgs
2021
2122from executorch .exir .dialects ._ops import ops as exir_ops
2223from executorch .exir .dialects .edge ._ops import EdgeOpOverload
@@ -109,7 +110,7 @@ def fold_and_annotate_arg(
109110 return
110111
111112 arg_quant_params = None
112- if arg .target in dq_ops :
113+ if arg .target in DQ_OPS :
113114 args = arg .args
114115 scales = args [1 ]
115116 if (
@@ -137,9 +138,9 @@ def fold_and_annotate_arg(
137138 if input_qparams is not None :
138139 node .meta ["input_qparams" ][i ] = input_qparams
139140 for n in nodes_to_remove :
140- if n .target not in dq_ops :
141+ if n .target not in DQ_OPS :
141142 raise RuntimeError (
142- f"Expected one of { dq_ops } dq_op, got { n .target } "
143+ f"Expected one of { DQ_OPS } dq_op, got { n .target } "
143144 )
144145
145146 node .replace_input_with (n , cast (Node , n .args [0 ]))
@@ -154,7 +155,7 @@ def call(self, graph_module: GraphModule) -> PassResult:
154155 if n .op != "call_function" :
155156 continue
156157 # Don't fold chains of quant-ops into each other.
157- if n .target in (* q_ops , * dq_ops ):
158+ if n .target in (* Q_OPS , * DQ_OPS ):
158159 continue
159160
160161 # Make sure we haven't already set qparams meta information on the node
@@ -184,7 +185,7 @@ def call(self, graph_module: GraphModule) -> PassResult:
184185 # Copy the users, since we are modifying it.
185186 users_copy = copy .copy (n .users )
186187 for i , user in enumerate (users_copy ):
187- if user .target not in q_ops :
188+ if user .target not in Q_OPS :
188189 continue
189190
190191 # quantization node found here, store the quantization parameters in meta value
@@ -221,7 +222,7 @@ def call(self, graph_module: GraphModule) -> PassResult:
221222
222223 # Make sure we have a quantized operator
223224 user = list (n .users )[0 ]
224- if user .target not in q_ops :
225+ if user .target not in Q_OPS :
225226 continue
226227
227228 qargs = QuantArgs .from_operator (user .target , user .args )
0 commit comments