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

Implement 3D and transposed 3D convolutions. #1945

Merged
merged 3 commits into from
Jul 2, 2024
Merged

Conversation

booti386
Copy link
Contributor

@booti386 booti386 commented Jun 29, 2024

Hi!
Please review this PR carefully, I started working both on neural networks and this crate only 4 days ago.
I hope there are no major mistakes.

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 #1278: Conv3d feature request

Changes

Implement 3D and 3D transposed convolutions for all the supported backends.

@booti386 booti386 force-pushed the main branch 2 times, most recently from ba5eebd to 06bc6f2 Compare June 30, 2024 00:04
@antimora
Copy link
Collaborator

Super cool!

Also I am glad you have added ONNX for Conv3d and implemented new ModuleDisplay!

I can review the PR but @nathanielsimard, @laggui and @louisfd are more qualified.

@nathanielsimard
Copy link
Member

Thanks a lot @booti386 for the PR. @laggui can you check if the ONNX part is valid, and @louisfd can also validate kernel implementations.

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.

Looking good on my end!

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.

I checked the import parts and they look good.

Copy link

codecov bot commented Jul 1, 2024

Codecov Report

Attention: Patch coverage is 93.33885% with 322 lines in your changes missing coverage. Please review.

Project coverage is 85.40%. Comparing base (a7efc10) to head (06bc6f2).
Report is 11 commits behind head on main.

Current head 06bc6f2 differs from pull request most recent head 2c67448

Please upload reports for the commit 2c67448 to get more accurate results.

Files Patch % Lines
crates/burn-jit/src/kernel/conv/conv3d.rs 45.76% 96 Missing ⚠️
crates/burn-autodiff/src/ops/module.rs 69.43% 81 Missing ⚠️
crates/burn-tensor/src/tensor/ops/modules/conv.rs 88.64% 46 Missing ⚠️
crates/burn-tch/src/ops/module.rs 0.00% 43 Missing ⚠️
crates/burn-candle/src/ops/module.rs 0.00% 14 Missing ⚠️
crates/burn-import/src/onnx/op_configuration.rs 90.97% 12 Missing ⚠️
crates/burn-core/src/nn/padding.rs 61.90% 8 Missing ⚠️
crates/burn-core/src/record/serde/adapter.rs 25.00% 6 Missing ⚠️
crates/burn-ndarray/src/ops/conv.rs 98.54% 4 Missing ⚠️
crates/burn-tensor/src/repr/operation.rs 91.30% 4 Missing ⚠️
... and 6 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1945      +/-   ##
==========================================
+ Coverage   85.04%   85.40%   +0.36%     
==========================================
  Files         793      805      +12     
  Lines       94600    99248    +4648     
==========================================
+ Hits        80449    84760    +4311     
- Misses      14151    14488     +337     

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

@antimora
Copy link
Collaborator

antimora commented Jul 1, 2024

Can we add a couple check boxes under: Conv3d and ConvTranspose3d in https://github.com/tracel-ai/burn/blob/main/crates/burn-import/SUPPORTED-ONNX-OPS.md? Folks would be happy to see we now support Conv2d and ConvTranspose3d!

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.

Looked over the ONNX import, everything looks good! 👍

Thanks for adding conv3d 🙏

@@ -72,10 +72,19 @@ name = "conv-transpose2d"
path = "benches/conv_transpose2d.rs"
harness = false

[[bench]]
Copy link
Member

@laggui laggui Jul 2, 2024

Choose a reason for hiding this comment

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

Nice! We even have a benchmark available 🔥

match key.as_str() {
"kernel_shape" => kernel_shape = value.clone().into_i64s(),
"strides" => strides = value.clone().into_i64s(),
"pads" => pads = value.clone().into_i64s(),
Copy link
Member

Choose a reason for hiding this comment

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

Just realized we don't parse the auto_pad attribute (mutually exclusive) but that applies to all conv so no worries we can keep it as the current limitation. Don't think it's used that much.

@booti386
Copy link
Contributor Author

booti386 commented Jul 2, 2024

Great! Thank you all for your very positive reviews!

@laggui
Copy link
Member

laggui commented Jul 2, 2024

Great! Thank you all for your very positive reviews!

Before we merge could you update the SUPPORTED-ONNX-OPS.md file to reflect the new conv3d (as pointed out by @antimora)?

Thank you!

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
Copy link
Collaborator

antimora commented Jul 2, 2024

A test is failing after a recent Async merge:

image

Since this is not related to this PR changes, @nathanielsimard @louisfd @laggui , how should we go about this?

@laggui
Copy link
Member

laggui commented Jul 2, 2024

The issue has been fixed on main.

Pretty sure the tests were all passing before the rebase so we could probably just merge, but if not sure then the fix could be merged before running the tests.

@antimora antimora mentioned this pull request Jul 2, 2024
@antimora antimora merged commit d696d74 into tracel-ai:main Jul 2, 2024
6 of 12 checks passed
antimora added a commit that referenced this pull request Jul 2, 2024
antimora pushed a commit to antimora/burn that referenced this pull request Jul 2, 2024
* Implement 3D and transposed 3D convolutions.

* Merge changes from onnx-ir tracel-ai#1921 pr
antimora pushed a commit to antimora/burn that referenced this pull request Jul 2, 2024
* Implement 3D and transposed 3D convolutions.

* Merge changes from onnx-ir tracel-ai#1921 pr
syl20bnr added a commit that referenced this pull request Jul 4, 2024
syl20bnr pushed a commit that referenced this pull request Jul 5, 2024
* Implement 3D and transposed 3D convolutions.

* Merge changes from onnx-ir #1921 pr

---------

Co-authored-by: Dilshod Tadjibaev <939125+antimora@users.noreply.github.com>
syl20bnr added a commit that referenced this pull request Jul 5, 2024
syl20bnr pushed a commit that referenced this pull request Jul 5, 2024
* Implement 3D and transposed 3D convolutions.

* Merge changes from onnx-ir #1921 pr

---------

Co-authored-by: Dilshod Tadjibaev <939125+antimora@users.noreply.github.com>
syl20bnr added a commit that referenced this pull request Jul 5, 2024
syl20bnr added a commit that referenced this pull request Jul 5, 2024
nathanielsimard added a commit that referenced this pull request Jul 5, 2024
nathanielsimard added a commit that referenced this pull request Jul 5, 2024
nathanielsimard added a commit that referenced this pull request Jul 5, 2024
syl20bnr pushed a commit that referenced this pull request Jul 5, 2024
syl20bnr pushed a commit that referenced this pull request Jul 5, 2024
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.

Conv3d feature request
5 participants