Skip to content

Commit 995c2bf

Browse files
Add missing ops to ArmQuantizer (#6780)
Add missing ops to quantizer - Add missing ops such as chunk to quantizer. - Remove faulty ensures() from match_arg_shapes_rank pass. - Remove sum annotator and move sum annotation to one-to-one annotator. Signed-off-by: Oscar Andersson <oscar.andersson@arm.com>
1 parent dc41596 commit 995c2bf

File tree

6 files changed

+4
-70
lines changed

6 files changed

+4
-70
lines changed

backends/arm/_passes/match_arg_ranks_pass.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,3 @@ def call(self, graph_module: GraphModule) -> PassResult:
113113
graph_module.recompile()
114114
graph_module = super().call(graph_module).graph_module
115115
return PassResult(graph_module, True)
116-
117-
def ensures(self, graph_module):
118-
for node in graph_module.graph.nodes:
119-
if node.op != "call_function" or node.target not in self.targeted_ops:
120-
continue
121-
arg0_rank = node.args[0].meta["val"].dim()
122-
arg1_rank = node.args[1].meta["val"].dim()
123-
if arg0_rank != arg1_rank:
124-
raise ValueError(
125-
"Arguments of arithmetic operators need to have the same rank!"
126-
)

backends/arm/quantizer/arm_quantizer.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,6 @@ class ArmQuantizer(Quantizer):
270270
"mm",
271271
"one_to_one",
272272
"generic",
273-
"sum",
274273
]
275274

276275
def __init__(self) -> None:

backends/arm/quantizer/quantization_annotation/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,5 +59,4 @@ def decorator(annotator: AnnotatorType):
5959
mul_annotator,
6060
one_to_one_annotator,
6161
sub_annotator,
62-
sum_annotator,
6362
)

backends/arm/quantizer/quantization_annotation/generic_annotator.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
# torch.ops.aten.view_as_real.default,
4040
# torch.ops.aten.view_as_real_copy.default,
4141
torch.ops.aten.view.default,
42+
torch.ops.aten.view_as.default,
4243
torch.ops.aten.view_copy.default,
4344
torch.ops.aten.select.int,
4445
torch.ops.aten.select_copy.int,
@@ -53,6 +54,8 @@
5354
torch.ops.aten.flip.default,
5455
torch.ops.aten.cat.default,
5556
torch.ops.aten.stack.default,
57+
torch.ops.aten.chunk.default,
58+
torch.ops.aten.contiguous.default,
5659
]
5760

5861

backends/arm/quantizer/quantization_annotation/one_to_one_annotator.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ def _annotate_one_to_one(
4242
torch.ops.aten.rsqrt.default,
4343
torch.ops.aten.sigmoid.default,
4444
torch.ops.aten.tanh.default,
45+
torch.ops.aten.sum.dim_IntList,
4546
)
4647
for node in gm.graph.nodes:
4748
if node.op != "call_function" or node.target not in one_to_one_ops:

backends/arm/quantizer/quantization_annotation/sum_annotator.py

Lines changed: 0 additions & 57 deletions
This file was deleted.

0 commit comments

Comments
 (0)