Skip to content
DeepForgeby svx
All problems
EasyDeep Learningdl-334

Quantization Error Variance

Problem

Return the variance of round-to-nearest uniform quantization noise: step^2 / 12, where step is the quantization step size.

The signature is quantization_error_variance(step).

Hint

Uniform noise on [-step/2, step/2] has variance step^2/12.

Test cases

case 1
in: [1]
expected: 0.08333333333333333
case 2
in: [0.5]
expected: 0.020833333333333332
case 3
in: [0]
expected: 0
case 4
in: [2]
expected: 0.3333333333333333
Starter codePython
def quantization_error_variance(step):
    # Your code here
    pass

4 test cases · run your code against them in the editor