-
Notifications
You must be signed in to change notification settings - Fork 446
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
pad-input-fix: adding support for pads as attributes #2195
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2195 +/- ##
==========================================
- Coverage 86.08% 86.08% -0.01%
==========================================
Files 695 695
Lines 88995 89036 +41
==========================================
+ Hits 76612 76644 +32
- Misses 12383 12392 +9 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some small changes required to correctly support opset 2 of the Pad
operator.
Should be good to go after this 👍
if node.inputs.len() < 2 { | ||
panic!("Pad: must provide at least two inputs") | ||
if node.inputs.is_empty() { | ||
panic!("Pad: must be provide data as input") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Weird formulation. Makes more sense when you remove the "be": "Pad: must provide data as input"
@@ -768,9 +768,20 @@ pub fn tile_config(node: &Node) -> TileConfig { | |||
|
|||
/// Create a PadConfig from the attributes of the node | |||
pub fn pad_config(node: &Node) -> PadConfig { | |||
fn get_input_values(node: &Node, index: usize) -> Vec<i64> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is only used to retrieve the pads
input values, I would rename to get_pads_input
(and the index can be hardcoded).
"pads" => { | ||
pads = value | ||
.clone() | ||
.into_i64s() | ||
.iter() | ||
.map(|&x| { | ||
if x < 0 { | ||
panic!("Pad: Negative pad is not supported"); | ||
} | ||
x as usize | ||
}) | ||
.collect() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we are supporting the pads
as attribute, which corresponds to version 2 of the operator, then we should also parse the value
attribute to make sure we are correctly capturing all parameters of the node.
Make sure it doesn't come in conflict with the constant_value
input parsing for later versions of the operator 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops, last comment didn't catch your latest commit for the clippy fix.
LGTM with the changes, thanks!
@mepatrick73, was this supposed to fix #2151? I am still seeing the same issue... |
Pull Request Template
Checklist
run-checks all
script has been executed.Related Issues/PRs
#2151
Changes
Added support to pad being passed as an attribute. Also adding a check for the mode
Testing
Ran user model mentionned in #2151