[QwixOdmlOp] Update odml_op to 1) handle every leaf of pytree output activations for fake quantization and 2) allow ops to veto quantization requests from previous ops if the op is excluded from quantization.#223
Merged
copybara-service[bot] merged 1 commit intomainfrom Mar 6, 2026
Conversation
ceeffad to
bdca9b3
Compare
bdca9b3 to
94cfab3
Compare
…activations for fake quantization and 2) allow ops to veto quantization requests from previous ops if the op is excluded from quantization. 1) The `_fake_quant_output` method now iterates through all `jax.Array` leaves within the provided output structure. This ensures that auxiliary data, such as activation flags and quantization rules, are applied to individual arrays even when the output is a tuple or list, fixing issues like untagged arrays within `down_block` outputs. 2) The `_maybe_fake_quant` method now respects the current op's `act_qtype` when it is explicitly set to `None` and veto quantization requests from previous ops. 3) Add an abundance of inline comments to `_maybe_fake_quant` for better readability. PiperOrigin-RevId: 879782171
94cfab3 to
da19ac0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[QwixOdmlOp] Update odml_op to 1) handle every leaf of pytree output activations for fake quantization and 2) allow ops to veto quantization requests from previous ops if the op is excluded from quantization.
The
_fake_quant_outputmethod now iterates through alljax.Arrayleaves within the provided output structure. This ensures that auxiliary data, such as activation flags and quantization rules, are applied to individual arrays even when the output is a tuple or list, fixing issues like untagged arrays withindown_blockoutputs.The
_maybe_fake_quantmethod now respects the current op'sact_qtypewhen it is explicitly set toNoneand veto quantization requests from previous ops.Add an abundance of inline comments to
_maybe_fake_quantfor better readability.