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

Added some preliminary unit tests to the CNNs 'quantize_model' #927

Merged
merged 9 commits into from
Jul 29, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def quantize_model(
act_param_method='stats',
weight_quant_type='sym',
act_quant_granularity='per_tensor',
act_scale_computation_type='dynamic',
act_scale_computation_type='static',
uint_sym_act_for_unsigned_values=True,
dtype=torch.float32,
device='cpu'):
Expand All @@ -196,7 +196,7 @@ def quantize_model(
act_mantissa_bit_width,
act_exponent_bit_width)

if act_scale_computation_type == 'dynamic':
if act_scale_computation_type == 'dynamic' and backend != 'layerwise':
assert bias_bit_width is None, "Bias quantization is not supported with dynamic activation quantization"

weight_quant_format = quant_format
Expand Down Expand Up @@ -602,4 +602,5 @@ def check_positive_int(*args):
if arg is None:
continue
assert arg > 0.0
assert not math.isclose(arg, 0.0)
assert math.isclose(arg % 1, 0.0)
Loading
Loading