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

Add flip tensor operator #1468

Merged
merged 1 commit into from
Mar 19, 2024
Merged

Add flip tensor operator #1468

merged 1 commit into from
Mar 19, 2024

Conversation

carrotflakes
Copy link
Contributor

@carrotflakes carrotflakes commented Mar 13, 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

  1. Fixes Tensor flip along dimension #1099
  2. Update flip operation with Candle's native implementation #1489 is improvement to add Candle native impl

Changes

Added flip operation for tensors like the pytorch one. It has also been implemented for all backends.

The implementation for the Candle backend may be slow, but it can be replaced with more suitable methods, such as flip or step indexing, once these are implemented on Candle.

Testing

Added unit tests.

@carrotflakes carrotflakes marked this pull request as ready for review March 13, 2024 17:01
Copy link

codecov bot commented Mar 13, 2024

Codecov Report

Attention: Patch coverage is 94.14991% with 32 lines in your changes are missing coverage. Please review.

Project coverage is 85.76%. Comparing base (7a98b2f) to head (290f127).

Files Patch % Lines
crates/burn-tch/src/ops/int_tensor.rs 0.00% 6 Missing ⚠️
crates/burn-tch/src/ops/tensor.rs 0.00% 6 Missing ⚠️
crates/burn-autodiff/src/ops/tensor.rs 90.38% 5 Missing ⚠️
crates/burn-tch/src/ops/base.rs 0.00% 5 Missing ⚠️
crates/burn-autodiff/src/ops/bool_tensor.rs 0.00% 3 Missing ⚠️
crates/burn-autodiff/src/ops/int_tensor.rs 0.00% 3 Missing ⚠️
crates/burn-tch/src/ops/bool_tensor.rs 0.00% 3 Missing ⚠️
crates/burn-tensor/src/tensor/api/base.rs 94.73% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1468      +/-   ##
==========================================
+ Coverage   85.70%   85.76%   +0.05%     
==========================================
  Files         645      648       +3     
  Lines       71953    72497     +544     
==========================================
+ Hits        61669    62178     +509     
- Misses      10284    10319      +35     

☔ 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.

LGTM, seems pretty well done. Requesting @louisfd to double check before merging, but great job! 🎉

Copy link
Collaborator

@antimora antimora left a comment

Choose a reason for hiding this comment

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

LGTM

@antimora antimora merged commit 8911093 into tracel-ai:main Mar 19, 2024
14 checks passed
@antimora
Copy link
Collaborator

Reviewed it myself and merged it so we can unblock new tensor op PRs.

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.

Tensor flip along dimension
3 participants