Skip to content

Commit 00f8740

Browse files
authored
[converter] same q_params for neg in mul_scalar (#360)
1 parent e9ddf32 commit 00f8740

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tinynn/converter/operators/torch/quantized.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,16 @@ class QuantizedMulScalarOperator(QuantizedMulScalarSchema):
1818
def parse(self, node, attrs, args, graph_converter):
1919
super().parse(node, attrs, args, graph_converter)
2020

21+
is_neg = False
22+
if self.input_tensors[1] in (-1, -1.0):
23+
self.input_tensors[1] *= -1
24+
is_neg = True
25+
2126
self.run(node)
27+
28+
if is_neg:
29+
self.input_tensors[1] *= -1
30+
2231
QuantizedMulOperator.parse_common(self, node, attrs, args, graph_converter)
2332

2433

0 commit comments

Comments
 (0)