Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the error of dygraph qat unit test #33574

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 3 additions & 13 deletions python/paddle/fluid/contrib/slim/tests/test_imperative_qat.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ def tearDownClass(cls):
print("Failed to delete {} due to {}".format(cls.root_path, str(e)))

def set_vars(self):
self.weight_quantize_type = None
self.activation_quantize_type = None
self.weight_quantize_type = 'abs_max'
self.activation_quantize_type = 'moving_average_abs_max'
print('weight_quantize_type', self.weight_quantize_type)

def run_qat_save(self):
def test_qat(self):
self.set_vars()

imperative_qat = ImperativeQuantAware(
Expand Down Expand Up @@ -200,15 +200,5 @@ def run_qat_save(self):
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__':
unittest.main()
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ def set_vars(self):
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__':
unittest.main()