All problems
Quantized Matmul Error Bound
Problem
Bound the output error of a quantized dot product: with every weight off by at most weight_error in absolute value, the output error is bounded by sum(|x_i|) * |weight_error|. Return the bound.
The signature is quantized_matmul_error_bound(x, weight_error).
Hint
The bound follows from the triangle inequality applied term by term.
Test cases
case 1
in: [[1,-2,3],0.01]
expected: 0.06
case 2
in: [[],0.5]
expected: 0
case 3
in: [[0,0],1]
expected: 0
case 4
in: [[-1.5],0.2]
expected: 0.3
Starter codePython
def quantized_matmul_error_bound(x, weight_error):
# Your code here
pass4 test cases · run your code against them in the editor