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

Tensor expand operator #1508

Merged
merged 81 commits into from
Mar 22, 2024
Merged

Tensor expand operator #1508

merged 81 commits into from
Mar 22, 2024

Conversation

antimora
Copy link
Collaborator

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

fixes #1412

Changes

  1. All backends
  2. Fix issue with WGPU when stride == 0
  3. Add new tests
  4. Update docs

Testing

New unit tests

@antimora antimora requested a review from louisfd March 22, 2024 18:28
Copy link

codecov bot commented Mar 22, 2024

Codecov Report

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

Project coverage is 85.91%. Comparing base (dc45cf1) to head (0c95cf1).

❗ Current head 0c95cf1 differs from pull request most recent head 5f32187. Consider uploading reports for the commit 5f32187 to get more accurate results

Files Patch % Lines
crates/burn-jit/src/ops/base.rs 80.48% 8 Missing ⚠️
crates/burn-tensor/src/tensor/api/base.rs 85.96% 8 Missing ⚠️
crates/burn-tch/src/ops/base.rs 0.00% 7 Missing ⚠️
crates/burn-autodiff/src/ops/bool_tensor.rs 0.00% 6 Missing ⚠️
crates/burn-autodiff/src/ops/int_tensor.rs 0.00% 6 Missing ⚠️
crates/burn-tch/src/ops/bool_tensor.rs 0.00% 6 Missing ⚠️
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 93.05% 5 Missing ⚠️
crates/burn-fusion/src/stream/operation.rs 50.00% 2 Missing ⚠️
... and 1 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1508      +/-   ##
==========================================
+ Coverage   85.88%   85.91%   +0.02%     
==========================================
  Files         661      663       +2     
  Lines       74876    75446     +570     
==========================================
+ Hits        64307    64816     +509     
- Misses      10569    10630      +61     

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

crates/burn-autodiff/src/ops/tensor.rs Outdated Show resolved Hide resolved
crates/burn-fusion/src/ops/boolean.rs Outdated Show resolved Hide resolved
crates/burn-fusion/src/ops/float.rs Outdated Show resolved Hide resolved
crates/burn-fusion/src/ops/boolean.rs Outdated Show resolved Hide resolved
crates/burn-jit/src/ops/base.rs Show resolved Hide resolved
crates/burn-tensor/src/tensor/api/check.rs Outdated Show resolved Hide resolved
Copy link
Member

@louisfd louisfd left a comment

Choose a reason for hiding this comment

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

Small things related to autodiff, otherwise looks good!

crates/burn-autodiff/src/ops/tensor.rs Outdated Show resolved Hide resolved
crates/burn-autodiff/src/ops/tensor.rs Outdated Show resolved Hide resolved
Copy link
Member

@laggui laggui left a comment

Choose a reason for hiding this comment

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

Not much to add to the others' comments. I was also confused by the constant switch between expand <-> broadcast but it seems that it will be addressed.

To be fair, in pytorch tensor.expand(shape) is equivalent to torch.broadcast_to(tensor, shape).

I noticed the docstrings still used "broadcast" but it makes sense since they're only meant to explain the function.

@antimora antimora merged commit 6feda90 into tracel-ai:main Mar 22, 2024
12 checks passed
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.

Add expand tensor operation similar to PyTorch
4 participants