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

Feat: Add movedim tensor operator #1876

Merged
merged 15 commits into from
Jun 14, 2024

Conversation

LilDojd
Copy link
Contributor

@LilDojd LilDojd commented Jun 10, 2024

Pull Request Template

Checklist

  • Confirmed that run-checks all script has been executed.
  • Made sure the book is up to date with changes in this PR.

Related Issues/PRs

None

Changes

Added movedim default implementation. Mirrors the PyTorch one.

This just wraps a call to permute with sanity checks, but moving one/few axes while keeping all others inbound is a common enough operation to warrant its specific convenient syntactic sugar.

Testing

Added unit tests.

Copy link

codecov bot commented Jun 10, 2024

Codecov Report

Attention: Patch coverage is 97.44318% with 9 lines in your changes missing coverage. Please review.

Project coverage is 86.19%. Comparing base (d28183c) to head (a01f59d).
Report is 14 commits behind head on main.

Files Patch % Lines
crates/burn-tensor/src/tensor/api/check.rs 95.04% 5 Missing ⚠️
crates/burn-tensor/src/tensor/api/base.rs 93.10% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1876      +/-   ##
==========================================
- Coverage   86.28%   86.19%   -0.10%     
==========================================
  Files         774      779       +5     
  Lines       90095    91179    +1084     
==========================================
+ Hits        77740    78588     +848     
- Misses      12355    12591     +236     

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

Copy link
Member

@nathanielsimard nathanielsimard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution!

crates/burn-tensor/src/tensor/api/base.rs Outdated Show resolved Hide resolved
crates/burn-tensor/src/tensor/api/check.rs Outdated Show resolved Hide resolved
crates/burn-tensor/src/tensor/api/base.rs Outdated Show resolved Hide resolved
…rray

♻️ (check.rs): remove hashbrown::HashSet dependency and replace with nested loops for duplicate check
@LilDojd
Copy link
Contributor Author

LilDojd commented Jun 14, 2024

Thanks for the review! I have addressed your comments in recent commit

@nathanielsimard nathanielsimard merged commit b71c300 into tracel-ai:main Jun 14, 2024
14 checks passed
@LilDojd LilDojd deleted the feat/ops/movedim branch June 14, 2024 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants