Commit 13d06d3c authored by Jan Brouwer's avatar Jan Brouwer
Browse files

avoid division by 0 in generate_acoustic_environments_metadata.py update_quantization_error()

parent 442884c8
Loading
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -57,6 +57,10 @@ max_quantization_error = {


def update_quantization_error(name, quantized_value, value):
    if value == 0:
        if quantized_value != 0:
            print('    {}: value = 0, quantized value = {}'.format(name, quantized_value))
    else:
        max_quantization_error[name] = max(abs(quantized_value - value) / value, max_quantization_error[name])
        if print_quantized:
            print('    {}: {}'.format(name, quantized_value))