{"record":{"id":"006cfd4b13e8519f","repo":"huggingface/candle","slug":"unsupported-coordinate-transformation-mode-for-res","errorCode":null,"errorMessage":"Unsupported coordinate_transformation_mode for resize: {}","messagePattern":"Unsupported coordinate_transformation_mode for resize: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"candle-onnx/src/eval.rs","lineNumber":2358,"sourceCode":"                let coordinate_transformation_mode =\n                    get_attr_opt::<str>(node, \"coordinate_transformation_mode\")?\n                        .unwrap_or(\"half_pixel\");\n                // Interpolation mode: nearest, linear, or cubic.\n                let mode = get_attr_opt::<str>(node, \"mode\")?.unwrap_or(\"nearest\");\n                // How to determine the \"nearest\" pixel in nearest interpolation mode.\n                let nearest_mode =\n                    get_attr_opt::<str>(node, \"nearest_mode\")?.unwrap_or(\"round_prefer_floor\");\n\n                if mode != \"nearest\" {\n                    bail!(\"Unsupported resize mode: {}\", mode);\n                }\n\n                if nearest_mode != \"floor\" {\n                    bail!(\"Unsupported nearest_mode for resize: {}\", nearest_mode);\n                }\n\n                if coordinate_transformation_mode != \"asymmetric\" {\n                    bail!(\n                        \"Unsupported coordinate_transformation_mode for resize: {}\",\n                        coordinate_transformation_mode\n                    );\n                }\n\n                let h = output_dims[2];\n                let w = output_dims[3];\n                let output = input.upsample_nearest2d(h, w)?;\n\n                values.insert(node.output[0].clone(), output);\n            }\n            \"Trilu\" => {\n                let input = get(&node.input[0])?;\n\n                // Get the diagonal offset 'k' from the second input if provided\n                let k = if node.input.len() > 1 && !node.input[1].is_empty() {\n                    to_vec0_flexible::<i64>(get(&node.input[1])?)?\n                } else {","sourceCodeStart":2340,"sourceCodeEnd":2376,"githubUrl":"https://github.com/huggingface/candle/blob/d5fee525bfde3273eb7c9b75fd2bc4937be867ca/candle-onnx/src/eval.rs#L2340-L2376","documentation":"candle-onnx's Resize implementation only supports coordinate_transformation_mode=\"asymmetric\". ONNX defines several modes (half_pixel, align_corners, pytorch_half_pixel, tf_half_pixel_for_nn, etc.) and the default is half_pixel, so most exported models trigger this error even when mode/nearest_mode are supported.","triggerScenarios":"Evaluating a Resize node whose coordinate_transformation_mode attribute is anything other than \"asymmetric\", including the spec default \"half_pixel\".","commonSituations":"PyTorch exports using align_corners=False produce half_pixel; align_corners=True exports produce align_corners; TF exports produce tf_half_pixel_for_nn — all rejected.","solutions":["Rewrite the Resize node attributes to coordinate_transformation_mode=\"asymmetric\" via onnx-surgement/graph surgery (verify numerics)","Add half_pixel support to candle-onnx eval.rs","Compute the resize outside the ONNX graph in candle code","Use onnxruntime for this model"],"exampleFix":"// before\n// coordinate_transformation_mode = \"half_pixel\" (default)\n// after\nnode.attribute.push(onnx_attr(\"coordinate_transformation_mode\", \"asymmetric\"));","handlingStrategy":"validation","validationCode":"if node.op_type == \"Resize\" {\n    let ctm = get_attr_opt::<String>(node, \"coordinate_transformation_mode\")?.unwrap_or_else(|| \"half_pixel\".into());\n    if ctm != \"asymmetric\" { return Err(format!(\"ctm {} unsupported\", ctm)); }\n}","typeGuard":"fn uses_asymmetric_ctm(node: &Node) -> bool {\n    get_attr_opt::<String>(node, \"coordinate_transformation_mode\").ok().flatten().map_or(false, |m| m == \"asymmetric\")\n}","tryCatchPattern":"match eval(...) {\n    Err(e) if e.contains(\"coordinate_transformation_mode\") => fallback_to_onnxruntime(model),\n    other => other,\n}","preventionTips":["Remember the spec default is half_pixel, which is unsupported","Set coordinate_transformation_mode='asymmetric' at export if numerics allow","Check resize attributes with onnx.helper during CI"],"tags":["onnx","resize","unsupported-feature"],"backgroundTag":"unsupported-operator-feature","analyzedSha":"d5fee525bfde3273eb7c9b75fd2bc4937be867ca","analyzedAt":"2026-09-02T00:15:47.023Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}