[Type] Tensor 7: Test layout= + needs_grad= grad-buffer round-…#527
Closed
hughperkins wants to merge 15 commits intohp/tensor-stork-6from
Closed
[Type] Tensor 7: Test layout= + needs_grad= grad-buffer round-…#527hughperkins wants to merge 15 commits intohp/tensor-stork-6from
hughperkins wants to merge 15 commits intohp/tensor-stork-6from
Conversation
…trip Test-only PR closing the gap left by PRs 5 and 6: the combination of layout= and needs_grad= was checked at allocation time, but not yet exercised through a kernel write/read on the .grad buffer with a non- identity layout. This pins down the pre-impl POC Q3b finding (grad SNode inherits the primal's axis_seq) so any upstream Quadrants regression in this area surfaces immediately. Adds 8 tests: - rank-2 transposed-storage primal+grad kernel round-trip - rank-3 (2, 0, 1) primal+grad kernel round-trip - all 6 rank-3 layout permutations with primal+grad written and read All tests pass; no production-code or doc changes.
Collaborator
Author
|
Would prefer to add the ndarray layout first really, but ... |
b6e6e16 to
c4fbfa5
Compare
a9ad07c to
a4664d5
Compare
cca6562 to
b6e6e16
Compare
Drops the 'flexible' prefix from filenames and identifiers introduced in this branch series so the user-visible names are simply 'tensor'. Also strips PR-N back-references that will be meaningless once these PRs land. Touches only files owned by this series (no changes to external/ or unrelated tests).
- ruff/black: re-sort imports and reformat python/quadrants/_tensor.py (and reorder _tensor import in __init__.py) - pylint: silence import-outside-toplevel on the intentional late imports inside the qd.tensor* dispatchers - test_api: add Backend, tensor, tensor_annotation, tensor_mat, tensor_vec to the qd allowlist (newly exported by _tensor) - docs/tensor.md: drop broken #fields / #ndarrays anchors in the intro paragraph (the next paragraph already links to the actual pages) Made-with: Cursor
…r-stork-7 Made-with: Cursor # Conflicts: # python/quadrants/__init__.py
PR 6 made qd.tensor() reject the order= kwarg in favor of layout=, but test_tensor_kwargs_pass_through_to_field still passed order="ji" and expected it to reach qd.field. Switch the test to needs_grad=True, which is the canonical field-only kwarg today, and assert the grad buffer is allocated. The order=-rejection contract is already covered by test_order_kwarg_rejected in test_tensor_layout.py. Made-with: Cursor
…r-stork-7 Made-with: Cursor # Conflicts: # docs/source/user_guide/tensor.md # python/quadrants/_tensor.py
…rrency Made-with: Cursor
…r-stork-7 # Conflicts: # python/quadrants/_tensor.py
…r-stork-7 # Conflicts: # python/quadrants/_tensor.py
… PR-6 merge The PR-3 privatization renamed tensor_vec / tensor_mat to private impls in _tensor.py. When merging PR 6 forward into PR 7 in this branch's history, a conflict-resolution slip restored HEAD's copy of the file (checkout --ours) which still had the old top-level names + the old __all__. The Vector.tensor / Matrix.tensor classmethods on PR 7 import _tensor_vec / _tensor_mat, so without this fix calling them raises ImportError. Re-apply the rename: - _tensor.py: drop the dead public tensor_vec / tensor_mat function defs, restore the private _tensor_vec / _tensor_mat impls, drop the two stale entries from __all__ (already done correctly via PR 4 merge resolution but the function defs hadn't followed). - docs/source/user_guide/tensor.md: switch the "Vector and matrix tensors" section and the needs_grad note to qd.Vector.tensor / qd.Matrix.tensor wording. No new functionality, no test changes — just bringing PR 7 in line with what PRs 5 and 6 already had. Will cascade-merge into PRs 8-14 which still carry the same regression.
Made-with: Cursor
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.
…trip
Test-only PR closing the gap left by PRs 5 and 6: the combination of layout= and needs_grad= was checked at allocation time, but not yet exercised through a kernel write/read on the .grad buffer with a non- identity layout.
This pins down the pre-impl POC Q3b finding (grad SNode inherits the primal's axis_seq) so any upstream Quadrants regression in this area surfaces immediately.
Adds 8 tests:
All tests pass; no production-code or doc changes.
Issue: #
Brief Summary
copilot:summary
Walkthrough
copilot:walkthrough