Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve axes in permutedims #319

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

jishnub
Copy link
Member

@jishnub jishnub commented Dec 5, 2023

The vector method is unnecessary, as the fallback Base method uses reshape, which will do the same.

For the other method:
On master,

julia> F = Fill(2, (SOneTo(2), SOneTo(3)))
2×3 Fill{Int64, 2, Tuple{SOneTo{2}, SOneTo{3}}} with indices SOneTo(2)×SOneTo(3), with entries equal to 2

julia> permutedims(F)
3×2 Fill{Int64, 2, Tuple{SOneTo{3}, SOneTo{2}}} with indices SOneTo(3)×SOneTo(2), with entries equal to 2

julia> permutedims(F, (2,1))
3×2 Fill{Int64}, with entries equal to 2

In the second operation, the static axes are lost. After this PR, the axes are preserved:

julia> permutedims(F, (2,1))
3×2 Fill{Int64, 2, Tuple{SOneTo{3}, SOneTo{2}}} with indices SOneTo(3)×SOneTo(2), with entries equal to 2

To make this type-stable, we require aggressive constant propagation on the permutation tuple.

Copy link

codecov bot commented Dec 5, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (c7c34aa) 99.89% compared to head (7ce8f5b) 99.89%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #319   +/-   ##
=======================================
  Coverage   99.89%   99.89%           
=======================================
  Files           8        8           
  Lines         920      921    +1     
=======================================
+ Hits          919      920    +1     
  Misses          1        1           

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

@jishnub jishnub changed the title Remove unnecessary permutedims method Preserve axes in permutedims Dec 5, 2023
@jishnub jishnub marked this pull request as draft December 5, 2023 15:18
@jishnub jishnub marked this pull request as ready for review December 12, 2023 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant