{"record":{"id":"dbb58fad20060237","repo":"huggingface/candle","slug":"more-dilations-than-expected-in-conv1d-s","errorCode":null,"errorMessage":"more dilations than expected in conv1d {s:?} {}","messagePattern":"more dilations than expected in conv1d (.+?) (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"candle-onnx/src/eval.rs","lineNumber":912,"sourceCode":"                                    (*p1 as usize, xs.clone())\n                                }\n                            }\n                            Some(pads) => {\n                                bail!(\"more pads than expected in conv1d {pads:?} {}\", node.name)\n                            }\n                        };\n                        let strides = match strides {\n                            None => 1,\n                            Some([p]) => *p as usize,\n                            Some(s) => {\n                                bail!(\"more strides than expected in conv1d {s:?} {}\", node.name)\n                            }\n                        };\n                        let dilations = match dilations {\n                            None => 1,\n                            Some([p]) => *p as usize,\n                            Some(s) => {\n                                bail!(\"more dilations than expected in conv1d {s:?} {}\", node.name)\n                            }\n                        };\n                        xs.conv1d(ws, pads, strides, dilations, groups as usize)?\n                    }\n                    4 => {\n                        let (pads, xs) = match pads {\n                            None => (0, xs.clone()),\n                            Some([p]) => (*p as usize, xs.clone()),\n                            Some(&[p1, p2, p3, p4]) => {\n                                let p1 = p1 as usize;\n                                let p2 = p2 as usize;\n                                let p3 = p3 as usize;\n                                let p4 = p4 as usize;\n                                if p1 != p2 || p1 != p3 || p1 != p4 {\n                                    (0, xs.pad_with_zeros(2, p1, p3)?.pad_with_zeros(3, p2, p4)?)\n                                } else {\n                                    (p1, xs.clone())\n                                }","sourceCodeStart":894,"sourceCodeEnd":930,"githubUrl":"https://github.com/huggingface/candle/blob/d5fee525bfde3273eb7c9b75fd2bc4937be867ca/candle-onnx/src/eval.rs#L894-L930","documentation":"candle-onnx's Conv operator evaluator only supports 1D convolution when the `dilations` attribute contains a single value (or is absent, defaulting to 1). If the attribute has more than one element it cannot be mapped to the scalar dilation candle's conv1d accepts, so simple_eval_ bails with this message. The node name is included to locate the offending Conv node in the ONNX graph.","triggerScenarios":"Running simple_eval/simple_eval_ on an ONNX model whose Conv node has rank-1 weights and a `dilations` attribute with 2+ entries, e.g. dilations=[2,2] exported from a framework.","commonSituations":"Exporting a PyTorch/TensorFlow model where the exporter always writes 2-element dilation attributes even for 1D convs; converting models whose dilations were never intended to differ per axis.","solutions":["Edit the ONNX model to set dilations to a single-element list ([d]) or remove the attribute (defaults to 1) using onnx.helper/onnxruntime tooling","Re-export the model ensuring Conv nodes with rank-1 kernels use 1D dilation attributes","Patch candle-onnx locally to accept Some([p1,p2]) when p1==p2 for conv1d","Preprocess the graph with the onnx optimizer/simplifier to normalize attributes"],"exampleFix":"// before: dilations: [2, 2] on a 1D conv node\n// after (onnx python):\nnode_attr = onnx.helper.make_attribute('dilations', [2])\nnode.attr.remove(next(a for a in node.attr if a.name == 'dilations'))\nnode.attr.append(node_attr)","handlingStrategy":"validation","validationCode":"// before candle_onnx::simple_eval\nfor node in &model.graph.node {\n    if node.op_type == \"Conv\" {\n        if let Some(d) = node.attribute.iter().find(|a| a.name == \"dilations\") {\n            let n = d.ints.len();\n            if n > 1 { panic!(\"node {}: conv1d dilations arity {} unsupported\", node.name, n); }\n        }\n    }\n}","typeGuard":"fn is_scalar_dilation(attr: &Attribute) -> bool {\n    attr.name == \"dilations\" && (attr.ints.is_empty() || attr.ints.len() == 1)\n}","tryCatchPattern":"match candle_onnx::simple_eval(&model, &inputs) {\n    Err(e) if e.to_string().contains(\"more dilations than expected in conv1d\") => {\n        eprintln!(\"fix the model's dilations attr: {e}\");\n    }\n    other => other?,\n}","preventionTips":["Inspect Conv attributes with Netron before running candle-onnx","Run onnx.checker.check_model plus a custom attribute-arity lint in CI","Export 1D convs from frameworks configured for 1-element dilation lists"],"tags":["onnx","conv1d","unsupported-attribute"],"backgroundTag":"unsupported-onnx-attribute","analyzedSha":"d5fee525bfde3273eb7c9b75fd2bc4937be867ca","analyzedAt":"2026-09-02T00:15:47.023Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}