Skip to content

Commit

Permalink
Fix ONNX densenet failed in tuning with 3h (#1372)
Browse files Browse the repository at this point in the history
  • Loading branch information
yuwenzho authored Oct 21, 2022
1 parent 8c75c88 commit 66b60a4
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions neural_compressor/adaptor/ox_utils/operators/maxpool.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,22 @@ def __init__(self, onnx_quantizer, onnx_node):
super(MaxPoolOperator, self).__init__(onnx_quantizer, onnx_node)

def quantize_check(self):
node = self.node
# if opset version is less than 12, just no change
if self.quantizer.opset_version < 12: # pragma: no cover
return False

if not self.quantizer.is_valid_quantize_weight(node.input[0]): # pragma: no cover
return False

return True

def quantize(self):
node = self.node
super().quantize()
node.name = node.name + '_quant'
self.quantizer.quantize_inputs(self.node, direct_int8=True)
if not self.disable_qdq_for_node_output or self.quantizer.mode != 'qdq':
self.quantizer.quantize_outputs(self.node, direct_int8=True)
node.name = node.name + "_quant"

def convert_check(self, convert_format):
node = self.node
Expand Down

0 comments on commit 66b60a4

Please sign in to comment.