Skip to content

Support ONNX DynamicQuantizeLinear#3675

Open
jesco-absolut wants to merge 1 commit into
huggingface:mainfrom
jesco-absolut:fix-3290-dynamic-quantize-linear
Open

Support ONNX DynamicQuantizeLinear#3675
jesco-absolut wants to merge 1 commit into
huggingface:mainfrom
jesco-absolut:fix-3290-dynamic-quantize-linear

Conversation

@jesco-absolut

Copy link
Copy Markdown

Summary

Adds DynamicQuantizeLinear support to candle-onnx.

This implements the ONNX v11 function semantics for F32 input to U8 output:

  • computes the adjusted min/max range including zero
  • returns scalar y_scale
  • returns scalar y_zero_point
  • quantizes output to U8
  • uses ties-to-even rounding to match ONNX / NumPy rint

Fixes #3290.

Tests

Added test_dynamic_quantize_linear covering:

  • mixed positive/negative input
  • all-negative input
  • all-positive input
  • zero-range input
  • ties-to-even rounding behavior

Validation run:

cargo test --manifest-path candle-onnx/Cargo.toml --test ops test_dynamic_quantize_linear
cargo test --manifest-path candle-onnx/Cargo.toml --test ops -- --skip test_gelu_operation
cargo test --manifest-path candle-onnx/Cargo.toml --lib
cargo check --manifest-path candle-onnx/Cargo.toml
cargo fmt --manifest-path candle-onnx/Cargo.toml -- --check
git --no-pager diff --check

Known unrelated local failures:

  • full cargo test --manifest-path candle-onnx/Cargo.toml --test ops still fails only in existing test_gelu_operation exact-float mismatch: 0.8413447 vs 0.8413448
  • cargo clippy --manifest-path candle-onnx/Cargo.toml --tests -- -D warnings is blocked by pre-existing generated-code / existing eval.rs warnings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

candle-onnx support for DynamicQuantizeLinear

1 participant