{"record":{"id":"41b0dd4f9454582f","repo":"tracel-ai/burn","slug":"nearest-exact-interpolation-is-not-supported-for-n","errorCode":null,"errorMessage":"nearest exact interpolation is not supported for ndarray backend","messagePattern":"nearest exact interpolation is not supported for ndarray backend","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/burn-ndarray/src/ops/module.rs","lineNumber":310,"sourceCode":"            adaptive_avg_pool3d_backward::<E>(x, grad).into()\n        })\n    }\n\n    fn interpolate(\n        x: FloatTensor<Self>,\n        output_size: [usize; 2],\n        options: InterpolateOptions,\n    ) -> FloatTensor<Self> {\n        match options.mode {\n            InterpolateMode::Nearest => {\n                module_op!(inp(x), opt(), E, |x| nearest_interpolate::<E>(\n                    x,\n                    output_size\n                )\n                .into())\n            }\n            InterpolateMode::NearestExact => {\n                panic!(\"nearest exact interpolation is not supported for ndarray backend\")\n            }\n            InterpolateMode::Bilinear => {\n                let align_corners = options.align_corners;\n                module_op!(inp(x), opt(), E, |x| bilinear_interpolate::<E>(\n                    x,\n                    output_size,\n                    align_corners\n                )\n                .into())\n            }\n            InterpolateMode::Bicubic => {\n                let align_corners = options.align_corners;\n                module_op!(inp(x), opt(), E, |x| bicubic_interpolate::<E>(\n                    x,\n                    output_size,\n                    align_corners\n                )\n                .into())","sourceCodeStart":292,"sourceCodeEnd":328,"githubUrl":"https://github.com/tracel-ai/burn/blob/d16f7ba2ed0d41408189384044cc886fb4c8f957/crates/burn-ndarray/src/ops/module.rs#L292-L328","documentation":"The ndarray backend implements nearest, bilinear, and bicubic upsampling for interpolate(), but not the NearestExact mode (which matches ONNX/opencv nearest-exact semantics). Selecting that mode hits an explicit unimplemented panic.","triggerScenarios":"Calling tensor.interpolate(shape, InterpolateOptions::new(InterpolateMode::NearestExact)) on an NdArray backend tensor; loading/exported models (e.g. from ONNX) configured with nearest-exact upsampling.","commonSituations":"Importing models from ONNX where resize used nearest-exact; copying interpolate options from another backend without checking ndarray support.","solutions":["Switch to InterpolateMode::Nearest instead of NearestExact if exact half-pixel semantics are not critical.","Switch backends for this op or the whole model (e.g. burn-tch/cubecl) which supports NearestExact.","Implement nearest-exact manually (compute integer indices and gather) if semantics must match exactly.","Check model export settings to emit plain nearest instead of nearest-exact."],"exampleFix":"// before\nlet up = x.interpolate([h*2, w*2], InterpolateOptions::new(InterpolateMode::NearestExact)); // panic\n// after\nlet up = x.interpolate([h*2, w*2], InterpolateOptions::new(InterpolateMode::Nearest));","handlingStrategy":"fallback","validationCode":"fn supported_interpolate_mode(mode: &InterpolateMode) -> Option<InterpolateMode> {\n    match mode {\n        InterpolateMode::NearestExact => None, // unsupported on ndarray\n        m => Some(m.clone()),\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Map NearestExact -> Nearest when targeting ndarray.","Check backend feature matrices before importing ONNX resize ops.","Prefer Nearest or Bilinear for portability across backends."],"tags":["rust","burn-ndarray","interpolate","unsupported"],"backgroundTag":"unsupported-operation","analyzedSha":"d16f7ba2ed0d41408189384044cc886fb4c8f957","analyzedAt":"2026-09-05T13:19:14.260Z","contentChangedAt":"2026-09-05T13:19:14.260Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}