Max absolute difference is the largest element-wise absolute difference between two outputs: max(|baseline − variant|). For logits, it reports the worst single-logit divergence. section 6.5
Quantized ResNet-18 logits
Against a PyTorch FP32 baseline, ORT Static INT8 has a max absolute difference of 1.119 across 100 ImageNette samples; ONNX FP32 has 0.00007. section 6.5
Listing 6.8 Tensor-level equivalence metrics
def compute_equivalence_metrics(baseline, variant, labels=None):
diff = baseline - variant #A
abs_diff = np.abs(diff)
# Per-sample cosine similarity, then average
dot = np.sum(baseline * variant, axis=1)
norm_b = np.linalg.norm(baseline, axis=1)
norm_v = np.linalg.norm(variant, axis=1)
cos_sim = dot / (norm_b * norm_v + 1e-12) #B
preds_base = np.argmax(baseline, axis=1)
preds_var = np.argmax(variant, axis=1)
agreement = np.mean(preds_base == preds_var) #C
return {
"max_abs_diff": float(abs_diff.max()),
"mean_abs_diff": float(abs_diff.mean()),
"cosine_sim": float(np.mean(cos_sim)),
"top1_agreement": float(agreement),
}The equivalence-metrics listing computes the value by taking the maximum of the element-wise absolute differences. section 6.5
