Repository navigation
Preserve integer-weight precision in Int64 and AtomicInt64 fills - #1207
Open
dhairyajangir wants to merge 4 commits into
Open
dhairyajangir wants to merge 4 commits into
dhairyajangir wants to merge 4 commits into
Conversation
Assisted-by: ClaudeCode:claude-opus-5-5
Assisted-by: ClaudeCode:claude-opus-5-5
- Object-dtype integer weights keep exact int64 values - Out-of-range integer weights raise OverflowError on integer storages - Select the exact path with a storage trait; Unlimited uses it too - Avoid repeated conversions and the numpy import on each fill Assisted-by: ClaudeCode:claude-opus-5-5
Member
|
🤖 AI text below 🤖 I pushed 3dc13d8 with fixes from a review of this branch:
Regression tests for each change are in |
This branch has not been deployed
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.
Int64andAtomicInt64currently convert fill weights todouble, soweight=2**53 + 1stores9007199254740992instead of9007199254740993, even though direct bin assignment preserves the value.Keep Python integers, NumPy integer scalars/0-D arrays, and integer-dtype weight buffers exact through the native binding when all weights fit signed 64-bit storage. Select that converter for the two integer storages, check unsigned values before narrowing, and preserve the existing scalar protocol for objects that also export arrays. Conversion stays under the GIL and the typed buffers remain alive during filling.
Related to #289. This addresses ingestion precision; the existing fractional-weight conversion and accumulator-overflow behavior remain. Sequences already promoted by NumPy to floating/object dtype retain their existing route.
Validation on Linux, CPython 3.13.16 and NumPy 2.5.4, using a fresh C++14 build:
pytest -n auto --benchmark-disable: 1,400 passed, four existing xfails.Codex assisted implementation and validation.
The upstream Tests workflow for
26adaa8dis held for maintainer authorization; please approve that run. Pre-commit.ci and Read the Docs have passed.