{"record":{"id":"f8de4d61195e6fe8","repo":"huggingface/candle","slug":"more-strides-than-expected-in-conv2d-s","errorCode":null,"errorMessage":"more strides than expected in conv2d {s:?} {}","messagePattern":"more strides than expected in conv2d (.+?) (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"candle-onnx/src/eval.rs","lineNumber":949,"sourceCode":"                            }\n                            Some(pads) => {\n                                bail!(\"more pads than expected in conv2d {pads:?} {}\", node.name)\n                            }\n                        };\n                        let strides = match strides {\n                            None => 1,\n                            Some([p]) => *p as usize,\n                            Some([p1, p2]) => {\n                                if p1 != p2 {\n                                    bail!(\n                                        \"strides have to be the same on both axis {pads:?} {}\",\n                                        node.name\n                                    )\n                                }\n                                *p1 as usize\n                            }\n                            Some(s) => {\n                                bail!(\"more strides than expected in conv2d {s:?} {}\", node.name)\n                            }\n                        };\n                        let dilations = match dilations {\n                            None => 1,\n                            Some([p]) => *p as usize,\n                            Some([p1, p2]) => {\n                                if p1 != p2 {\n                                    bail!(\n                                        \"dilations have to be the same on both axis {pads:?} {}\",\n                                        node.name\n                                    )\n                                }\n                                *p1 as usize\n                            }\n                            Some(s) => {\n                                bail!(\"more dilations than expected in conv2d {s:?} {}\", node.name)\n                            }\n                        };","sourceCodeStart":931,"sourceCodeEnd":967,"githubUrl":"https://github.com/huggingface/candle/blob/d5fee525bfde3273eb7c9b75fd2bc4937be867ca/candle-onnx/src/eval.rs#L931-L967","documentation":"candle-onnx maps the Conv `strides` attribute to one scalar for candle's conv1d/conv2d APIs; for rank-2 weights it accepts one or two equal values. A strides list with more than two elements (or otherwise unmatchable) cannot be handled, so simple_eval_ bails with this message.","triggerScenarios":"A Conv node whose `strides` attribute has 3+ elements (e.g. a 1D conv node exported with 3-element strides, or a corrupted/converted graph) hits the catch-all Some(s) arm.","commonSituations":"Graphs exported with rank mismatch between attribute length and kernel rank (e.g. 3D conv exported as Conv with rank-2 weights); automated model converters writing padded attribute lists.","solutions":["Fix the graph so the strides list length matches the weight rank (1 value for 1D, 2 for 2D)","Re-export the model with the correct op (Conv1d/Conv2d) so attributes have the right arity","Simplify the model with onnxsim to normalize attributes before inference","Patch candle-onnx to slice or validate strides per weight rank"],"exampleFix":"// before: strides: [1, 1, 1] on a rank-2 conv\n// after: strides: [1, 1]","handlingStrategy":"validation","validationCode":"for node in &model.graph.node {\n    if node.op_type == \"Conv\" {\n        if let Some(s) = node.attribute.iter().find(|a| a.name == \"strides\") {\n            if s.ints.len() > 2 {\n                panic!(\"node {}: strides arity {} unsupported\", node.name, s.ints.len());\n            }\n        }\n    }\n}","typeGuard":"fn strides_arity_ok(attr: &Attribute) -> bool {\n    attr.name != \"strides\" || matches!(attr.ints.len(), 0..=2)\n}","tryCatchPattern":"match candle_onnx::simple_eval(&model, &inputs) {\n    Err(e) if e.to_string().contains(\"more strides than expected\") => {\n        eprintln!(\"strides list doesn't match weight rank: {e}\");\n    }\n    other => other?,\n}","preventionTips":["Keep exporter op selection correct (Conv1d vs Conv2d) so attribute arity matches weight rank","Run onnxsim to normalize attributes","Check weight shape vs attribute arity in a model lint step"],"tags":["onnx","conv2d","strides","attribute-arity"],"backgroundTag":"unsupported-onnx-attribute","analyzedSha":"d5fee525bfde3273eb7c9b75fd2bc4937be867ca","analyzedAt":"2026-09-02T00:15:47.023Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}