Metrics
- qwantize.metrics.compute_metrics(W, W_dq, X=None)[source]
Compute weight and output quantization error metrics.
- Parameters:
W – Original weights of shape
(M, K).W_dq – Dequantized weights of shape
(M, K).X – Input activations of shape
(T, K). If provided, output error metrics are also computed.
- Returns:
"weight_error":||W_dq - W||_F"weight_error_pct":||W_dq - W||_F / ||W||_F * 100"output_error":||W_dq @ X.T - W @ X.T||_F(only if X given)"output_error_pct": normalized output error in percent (only if X given)
- Return type:
Dict with the following keys