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 ConvTranspose1d ONNX op #2349

Merged
merged 7 commits into from
Oct 21, 2024
Merged

Conversation

tiruka
Copy link
Contributor

@tiruka tiruka commented Oct 9, 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

#1714

Changes

Add ConvTranspose1d ONNX op in accordance with other conv transposed d onnx.

Testing

run-checks all has passed.

@tiruka tiruka marked this pull request as draft October 9, 2024 08:30
@tiruka tiruka changed the title WIP: add python, onnx model, burn/node for conv_transpose1d WIP: Add conv_transpose1d ONNX op Oct 9, 2024
@tiruka tiruka changed the title WIP: Add conv_transpose1d ONNX op WIP: Add ConvTranspose1d ONNX op Oct 9, 2024
Copy link

codecov bot commented Oct 9, 2024

Codecov Report

Attention: Patch coverage is 95.74468% with 12 lines in your changes missing coverage. Please review.

Project coverage is 85.22%. Comparing base (ebe2421) to head (90e75c6).
Report is 28 commits behind head on main.

Files with missing lines Patch % Lines
crates/burn-import/src/onnx/op_configuration.rs 88.23% 10 Missing ⚠️
crates/burn-import/src/onnx/to_burn.rs 92.85% 1 Missing ⚠️
crates/onnx-ir/src/dim_inference.rs 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2349      +/-   ##
==========================================
- Coverage   85.38%   85.22%   -0.16%     
==========================================
  Files         770      786      +16     
  Lines       98899   104088    +5189     
==========================================
+ Hits        84441    88706    +4265     
- Misses      14458    15382     +924     

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

@tiruka tiruka marked this pull request as ready for review October 14, 2024 00:35
@tiruka tiruka changed the title WIP: Add ConvTranspose1d ONNX op Add ConvTranspose1d ONNX op Oct 14, 2024
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.

Thanks for adding the op!

Implementation looks good, just a minor comment regarding padding.

Thanks to your comment it actually made me realize that the other conv transpose ops don't check the padding correctly 😅

crates/burn-import/src/onnx/op_configuration.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.

Awesome! Thanks for fixing the other conv transpose padding discrepancies 🎉

@laggui laggui merged commit b7887b0 into tracel-ai:main Oct 21, 2024
11 checks passed
@tiruka tiruka deleted the add-onnx-op-ConvTranspose1d branch October 21, 2024 13:11
@tiruka
Copy link
Contributor Author

tiruka commented Oct 21, 2024

@laggui
Thank you for your merging it. I am happy I could make contributions. 😀
BTW, I am about to push the following codes with tests to make some refactorings. 😅
What's in my mind is to make a common check function for negativeness, and symmetry about pads.
Do you feel if it is good? If so, I will make another PR. I'd like to hear your opinion.

fn check_symmetric_pads(pads: &Vec<i64>) {
    // Check the length of pads
    if pads.len() % 2 != 0 {
        panic!("Invalid length: pads must have an even number of elements");
    }

    let half_len = pads.len() / 2;

    // Check for negative values
    if pads.iter().any(|&pad| pad < 0) {
        panic!("Negative pad values are not supported");
    }

    // Check for asymmetric padding
    for i in 0..half_len {
        if pads[i] != pads[half_len + i] {
            panic!("Asymmetric padding is not supported");
        }
    }
}

Involved functions will be padding_config_1d, padding_config_2d, padding_config_3d, and conv_transpose1d_config, conv_transpose2d_config, conv_transpose3d_config.

Thank you in advance.

@laggui
Copy link
Member

laggui commented Oct 21, 2024

I actually was thinking about that while reading your changes, but I don't think it is worth it right now.

The number of lines reduced just to have one function do the check isn't much, and the current checks make it more explicit for each op.

@tiruka
Copy link
Contributor Author

tiruka commented Oct 21, 2024

Ok, fine.

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