未验证 提交 3af16297 编写于 作者: C cc 提交者: GitHub

fix the error of qat unit test (#33574)

上级 918aeb71
...@@ -64,11 +64,11 @@ class TestImperativeQat(unittest.TestCase): ...@@ -64,11 +64,11 @@ class TestImperativeQat(unittest.TestCase):
print("Failed to delete {} due to {}".format(cls.root_path, str(e))) print("Failed to delete {} due to {}".format(cls.root_path, str(e)))
def set_vars(self): def set_vars(self):
self.weight_quantize_type = None self.weight_quantize_type = 'abs_max'
self.activation_quantize_type = None self.activation_quantize_type = 'moving_average_abs_max'
print('weight_quantize_type', self.weight_quantize_type) print('weight_quantize_type', self.weight_quantize_type)
def run_qat_save(self): def test_qat(self):
self.set_vars() self.set_vars()
imperative_qat = ImperativeQuantAware( imperative_qat = ImperativeQuantAware(
...@@ -200,15 +200,5 @@ class TestImperativeQat(unittest.TestCase): ...@@ -200,15 +200,5 @@ class TestImperativeQat(unittest.TestCase):
msg='Failed to save the inference quantized model.') msg='Failed to save the inference quantized model.')
class TestImperativeQatAbsMax(TestImperativeQat):
def set_vars(self):
self.weight_quantize_type = 'abs_max'
self.activation_quantize_type = 'moving_average_abs_max'
print('weight_quantize_type', self.weight_quantize_type)
def test_qat(self):
self.run_qat_save()
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()
...@@ -43,9 +43,6 @@ class TestImperativeQatChannelWise(TestImperativeQat): ...@@ -43,9 +43,6 @@ class TestImperativeQatChannelWise(TestImperativeQat):
self.activation_quantize_type = 'moving_average_abs_max' self.activation_quantize_type = 'moving_average_abs_max'
print('weight_quantize_type', self.weight_quantize_type) print('weight_quantize_type', self.weight_quantize_type)
def test_qat(self):
self.run_qat_save()
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册