Fix endpoint handling for batched quantile grids - #526
Open
tandede wants to merge 2 commits into
Open
Conversation
tandede
marked this pull request as ready for review
August 20, 2026 08:35
Author
|
Hi maintainers, I wanted to follow up on this PR in case it was overlooked. It fixes endpoint handling for batched quantile grids and is ready for review. Please let me know if any changes or additional validation would be helpful. Thank you! |
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.
Summary
interpolate_quantilesaccepts a tensor of quantile levels matchingoriginal_values, allowing each batch element to use a different quantile grid. Endpoint padding was previously decided from the global minimum and maximum across the entire batch.If one row contained 0 or 1 while another did not, the latter row was left unpadded. Queries below that row's minimum produced a negative gather index, while queries above its maximum were extrapolated instead of using the endpoint value.
This change pads every flattened batch row with 0 and 1 and repeats that row's first and last values. Duplicate endpoints are safe for rows that already contain them.
Test plan
.venv/bin/python -m pytest -q test/test_utils.py— 7 passed.venv/bin/mypy src test— no issues in 24 source files.venv/bin/python -m pytest -q— 554 passed, 20 xfaileduvx ruff check --select E,F,I,B src/chronos/utils.py test/test_utils.pyuvx ruff format --check src/chronos/utils.py test/test_utils.pygit diff --check