All problems
Symmetric vs Asymmetric Quant Error
Problem
Compare MSE of symmetric and asymmetric int quantization. Symmetric uses scale = max(|x|) / (2^(bits-1)-1) with codes clamped to +/-qmax; asymmetric uses step = (max-min)/(2^bits-1) and the zero point implied by round((x-min)/step). Return [sym_mse, asym_mse].
The signature is symmetric_vs_asymmetric_mse(values, bits=8).
Hint
Asymmetric quantization uses the full code range but pays for a zero point.
Test cases
case 1
in: [[-1,1],8]
expected: [0,0]
case 2
in: [[-1,0,0.5],8]
expected: [0.000005166677000020648,0]
case 3
in: [[-3,4,1],4]
expected: [0.013605442176870777,0.013333333333333357]
case 4
in: [[0,0],8]
expected: [0,0]
Starter codePython
def symmetric_vs_asymmetric_mse(values, bits=8):
# Your code here
pass4 test cases · run your code against them in the editor