You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
decode_shots_bit_packed accepted non-contiguous NumPy views, but treated the bytes within each shot as contiguous. For a view such as shots[:, ::2], this could read the wrong bytes and decode a different set of detectors.
Use pybind11's two-dimensional array accessor so both strides are respected. Add a regression test where the second byte of each shot is non-contiguous.
Tests:
bazel test --jobs=1 src/... //docs:tutorial_jupytext_sync_test
Yes, this also handles Fortran-contiguous arrays. unchecked<2>() uses both NumPy strides for each (shot, byte) access. I checked a two-byte Fortran-order input locally, and it produced the expected predictions.
For C-contiguous input, the accessor does a little more index calculation than the previous raw pointer access. I have not benchmarked the two implementations, so I do not want to claim zero overhead. The decoding work is likely to dominate, but a contiguous fast path could be added later if profiling shows this matters.
Current main now handles this in the shared decode_sinter_shots_bit_packed helper added by #256, with coverage for row-strided, column-strided, and Fortran-ordered inputs. That covers the original bug more broadly than this branch, so I’m closing this PR as superseded. Thanks for the reviews and branch updates.
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
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.
decode_shots_bit_packedaccepted non-contiguous NumPy views, but treated the bytes within each shot as contiguous. For a view such asshots[:, ::2], this could read the wrong bytes and decode a different set of detectors.Use pybind11's two-dimensional array accessor so both strides are respected. Add a regression test where the second byte of each shot is non-contiguous.
Tests:
bazel test --jobs=1 src/... //docs:tutorial_jupytext_sync_testclang-format-14 --dry-run --Werror src/tesseract_sinter_compat.pybind.h