[pull] master from tensorflow:master - #8792
Merged
Merged
Conversation
…unction When Python's random module functions are used inside tf.function, the values are computed during tracing and become constants. This causes issues with XLA compilation when input shapes don't match the traced constant values. This change adds detection for Python random module functions and issues a helpful warning guiding users to use tf.random functions instead. Fixes #109111
PiperOrigin-RevId: 973205360
Imported from GitHub PR #118856 ## Summary Adds centralized validation for metadata-driven `chunk_index` values before vector access in proto splitter merge and fingerprint parsing paths. Malformed `.cpb` metadata could previously trigger unchecked indexing into `chunks` / `chunks_info` vectors during merge and fingerprint processing. This change introduces a shared `ValidateChunkIndex()` helper and applies it consistently across all affected metadata-driven lookup paths. ## Changes - Add shared `ValidateChunkIndex(uint64_t, size_t)` helper in `proto_splitter/cc/util.{h,cc}` - Validate root chunk indices in `Merger::Merge()` - Validate root chunk indices in `Merger::ReadFields()` - Validate nested chunk indices in `Merger::ProcessField()` (`READ` and `MERGE`) - Validate chunk indices in SavedModel fingerprint parsing paths - Add regression coverage for invalid root and nested chunk indices - Add regression coverage for invalid fingerprint metadata ## Behavior Before: - Malformed metadata could reach unchecked vector indexing paths After: - Invalid chunk indices fail deterministically with `absl::StatusCode::kFailedPrecondition` ## Testing Added regression tests for: - invalid root merge chunk index - invalid nested merge chunk index - invalid `ReadPartial()` metadata - invalid fingerprint parsing chunk index Copybara import of the project: -- 575231f by jmestwa-coder <jmestwa@gmail.com>: Validate metadata-driven chunk indices before vector access Merging this change closes #118856 COPYBARA_INTEGRATE_REVIEW=#118856 from jmestwa-coder:validate-chunk-index-bounds 575231f PiperOrigin-RevId: 973205398
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )