File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed
backends/xnnpack/partition/config Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change 1010from typing import List , Optional
1111
1212import torch
13+ from executorch .backends .xnnpack .utils .quant_utils import (
14+ is_dequant ,
15+ is_qparam ,
16+ is_quant ,
17+ )
1318from executorch .exir .backend .canonical_partitioners .config_partitioner import (
1419 format_target_name ,
1520 PartitionerConfig ,
@@ -223,9 +228,18 @@ def _check_node_has_valid_dtype(self, node):
223228 valid_dtypes = {
224229 torch .float32 ,
225230 torch .float16 ,
226- torch .int8 ,
227- torch .qint8 ,
228231 }
232+ # Only allow int8 and quant dtypes for quant operations
233+ if is_quant (node ) or is_dequant (node ) or is_qparam (node ):
234+ valid_dtypes .update (
235+ {
236+ torch .qint32 ,
237+ torch .qint8 ,
238+ torch .quint8 ,
239+ torch .int8 ,
240+ }
241+ )
242+
229243 if (
230244 node .op != "placeholder"
231245 and node .op != "call_function"
You can’t perform that action at this time.
0 commit comments