fix(lang): rank-safe default TensorData.copyToFloatArray (#930) - #934
Merged
Merged
Conversation
The interface default iterated a single flat index into the vararg get(), which trips every implementation's one-index-per-dimension arity require for rank >= 2 tensors. Masked today because the implementations that matter override the method — a latent trap for the next implementor. Unravel each flat position into per-dimension indices (row-major) instead. Rank-1 behavior is unchanged; rank-0 degenerates to a no-index get(). New contract test exercises the interface default (fixture deliberately does not override) at ranks 1, 2 and 3. Closes #930
|
📖 Documentation Preview The documentation has been built successfully for this PR. Generated Files:
Artifacts:
This comment will be updated automatically when the PR is updated. |
aharakal
approved these changes
Aug 10, 2026
|
📖 Documentation Preview The documentation has been built successfully for this PR. Generated Files:
Artifacts:
This comment will be updated automatically when the PR is updated. |
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.
The interface default indexed rank-≥2 tensors with a single flat index into the vararg
get(), tripping every implementation's arityrequire— full analysis in #930. Masked today only because the implementations that matter override it.Fix: unravel each flat position into per-dimension indices (row-major). Rank-1 unchanged, rank-0 degenerates to a no-index
get().Tests: new commonTest
TensorDataDefaultCopyTestwhose fixture deliberately does not overridecopyToFloatArray, exercising the interface default at ranks 1–3.Verified:
:skainet-lang:skainet-lang-core:jvmTestgreen (full module).Note: CHANGELOG entry included — expect trivial
[Unreleased]merge conflicts with sibling hygiene PRs (#927–#931 series), all resolvable by keeping both bullets.Closes #930