All problems
QAT vs PTQ Error Delta
Problem
Compare post-training quantization (PTQ) and quantization-aware training (QAT) error. Return [ptq_error - qat_error, (ptq_error - qat_error) / ptq_error], using 0.0 for the relative reduction when ptq_error is 0.
The signature is qat_vs_ptq_error(ptq_error, qat_error).
Hint
QAT usually narrows the gap because the network adapts to rounding during fine-tuning.
Test cases
case 1
in: [0.1,0.02]
expected: [0.08,0.7999999999999999]
case 2
in: [0.5,0.5]
expected: [0,0]
case 3
in: [0,0]
expected: [0,0]
case 4
in: [0.3,0.1]
expected: [0.19999999999999998,0.6666666666666666]
Starter codePython
def qat_vs_ptq_error(ptq_error, qat_error):
# Your code here
pass4 test cases · run your code against them in the editor