Skip to content

Commit

Permalink
ONNX pad arguments fix
Browse files Browse the repository at this point in the history
pad now requires 2 or more arguments
if the third argument is not given, it will default to 0
  • Loading branch information
mepatrick73 committed Jul 23, 2024
1 parent 2859976 commit c7b0029
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crates/burn-import/src/onnx/op_configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ pub fn layer_norm_config(node: &Node) -> (LayerNormConfig, bool) {
/// Create a PadConfig from the attributes of the node
pub fn pad_config(node: &Node) -> PadConfig {
fn get_pads(node: &Node) -> Vec<usize> {
if node.inputs.len() != 3 {
if node.inputs.len() > 1 {
panic!("Pad: must provide three inputs")
}

Expand Down Expand Up @@ -801,7 +801,7 @@ pub fn pad_config(node: &Node) -> PadConfig {
// TODO: support int, boolean
match &node.inputs[2].value {
Some(Data::Float32s(shape)) => shape.first().unwrap().to_owned(),
_ => panic!("Pad: should provide a constant value input to pad with, for example 0.0"),
_ => 0.0,
}
}

Expand Down

0 comments on commit c7b0029

Please sign in to comment.