15
15
get_param_tensor ,
16
16
is_param_node ,
17
17
)
18
+ from executorch .backends .arm .constants import DQ_OPS , Q_OPS
18
19
19
- from executorch .backends .arm .tosa_quant_utils import dq_ops , q_ops , QuantArgs
20
+ from executorch .backends .arm .tosa_quant_utils import QuantArgs
20
21
21
22
from executorch .exir .dialects ._ops import ops as exir_ops
22
23
from executorch .exir .dialects .edge ._ops import EdgeOpOverload
@@ -109,7 +110,7 @@ def fold_and_annotate_arg(
109
110
return
110
111
111
112
arg_quant_params = None
112
- if arg .target in dq_ops :
113
+ if arg .target in DQ_OPS :
113
114
args = arg .args
114
115
scales = args [1 ]
115
116
if (
@@ -137,9 +138,9 @@ def fold_and_annotate_arg(
137
138
if input_qparams is not None :
138
139
node .meta ["input_qparams" ][i ] = input_qparams
139
140
for n in nodes_to_remove :
140
- if n .target not in dq_ops :
141
+ if n .target not in DQ_OPS :
141
142
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 } "
143
144
)
144
145
145
146
node .replace_input_with (n , cast (Node , n .args [0 ]))
@@ -154,7 +155,7 @@ def call(self, graph_module: GraphModule) -> PassResult:
154
155
if n .op != "call_function" :
155
156
continue
156
157
# 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 ):
158
159
continue
159
160
160
161
# Make sure we haven't already set qparams meta information on the node
@@ -184,7 +185,7 @@ def call(self, graph_module: GraphModule) -> PassResult:
184
185
# Copy the users, since we are modifying it.
185
186
users_copy = copy .copy (n .users )
186
187
for i , user in enumerate (users_copy ):
187
- if user .target not in q_ops :
188
+ if user .target not in Q_OPS :
188
189
continue
189
190
190
191
# quantization node found here, store the quantization parameters in meta value
@@ -221,7 +222,7 @@ def call(self, graph_module: GraphModule) -> PassResult:
221
222
222
223
# Make sure we have a quantized operator
223
224
user = list (n .users )[0 ]
224
- if user .target not in q_ops :
225
+ if user .target not in Q_OPS :
225
226
continue
226
227
227
228
qargs = QuantArgs .from_operator (user .target , user .args )
0 commit comments