Skip to content

Conversation

crutcher
Copy link
Contributor

This is incomplete; it is a proposal to establish a burn::baselib::... tree; which exists pre-core and pre-tensor; but is also public for third-parties to use.

the first candidate is lifting the indexing, shape, range, and slice utils.

i've not resolved how to re-export things to maintain backwards compat; this is a rough proof of concept.

@crutcher
Copy link
Contributor Author

@laggui based upon discussions in development > #general

Copy link

codecov bot commented Jul 29, 2025

Codecov Report

❌ Patch coverage is 76.47059% with 32 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.53%. Comparing base (26c1e47) to head (35efa3b).
⚠️ Report is 118 commits behind head on main.

Files with missing lines Patch % Lines
...rates/burn-common/src/baselib/indexing/as_index.rs 30.00% 21 Missing ⚠️
crates/burn-common/src/baselib/indexing/shape.rs 87.91% 11 Missing ⚠️

❌ Your patch check has failed because the patch coverage (76.47%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.
❌ Your project check has failed because the head coverage (63.53%) is below the target coverage (80.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3432   +/-   ##
=======================================
  Coverage   63.52%   63.53%           
=======================================
  Files         982      984    +2     
  Lines      109937   109937           
=======================================
+ Hits        69838    69847    +9     
+ Misses      40099    40090    -9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@antimora
Copy link
Collaborator

We might want to review other common shape operations implemented in Candle for potential reuse or inspiration: candle-core/src/shape.rs

Candle’s shape.rs includes utilities like:

  • Shape validation and broadcasting helpers.
  • Indexing/slicing logic with bounds checks.
  • Contiguous shape transformations (e.g., reshape, permute, expand).
  • Stride and contiguous memory layout calculations.
  • Compact methods for computing element count and dimensionality.

@crutcher
Copy link
Contributor Author

I have a bunch of indexing / traversal iterator util stuff from a java tensor impl I built; and some of it might be worth stealing:
https://github.com/crutcher/tapestry/tree/main/src/main/java/org/tensortapestry/zspace/indexing

Basically, we often need these things not just to write correct third-party code that has the same generic flexibility as the API; but to write implementations/bindings of array-like objects into the tensor implementation layers.

Copy link
Contributor

github-actions bot commented Sep 2, 2025

This PR has been marked as stale because it has not been updated for over a month

@github-actions github-actions bot added the stale The issue or pr has been open for too long label Sep 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale The issue or pr has been open for too long
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants