feat: end-to-end compilation of a torch model

This commit is contained in:
jfrery
2021-11-23 11:25:53 +01:00
committed by jfrery
parent 13b9ff96f0
commit 1625475897
8 changed files with 231 additions and 33 deletions

View File

@@ -101,9 +101,7 @@ def test_quantized_linear(model, input_shape, n_bits, atol, seed_torch):
quantized_model = post_training_quant.quantize_module(numpy_input)
# Quantize input
q_input = QuantizedArray(n_bits, numpy_input)
# Get quantized prediction
q_prediction = quantized_model(q_input)
# Dequantize to get back to real values
dequant_prediction = q_prediction.dequant()
# Forward and Dequantize to get back to real values
dequant_prediction = quantized_model.forward_and_dequant(q_input)
assert numpy.isclose(numpy_prediction, dequant_prediction, atol=atol).all()