{"record":{"id":"cd54c7c720817411","repo":"tracel-ai/burn","slug":"bilinear-interpolation-backward-is-not-supported-f","errorCode":null,"errorMessage":"bilinear interpolation backward is not supported for ndarray backend","messagePattern":"bilinear interpolation backward is not supported for ndarray backend","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/burn-ndarray/src/ops/module.rs","lineNumber":356,"sourceCode":"            }\n        }\n    }\n\n    fn interpolate_backward(\n        x: FloatTensor<Self>,\n        grad: FloatTensor<Self>,\n        output_size: [usize; 2],\n        options: InterpolateOptions,\n    ) -> FloatTensor<Self> {\n        match options.mode {\n            InterpolateMode::Nearest => module_op!(inp(x, grad), opt(), E, |x, grad| {\n                nearest_interpolate_backward::<E>(x, grad, output_size).into()\n            }),\n            InterpolateMode::NearestExact => {\n                panic!(\"nearest exact interpolation backward is not supported for ndarray backend\")\n            }\n            InterpolateMode::Bilinear => {\n                panic!(\"bilinear interpolation backward is not supported for ndarray backend\")\n            }\n            InterpolateMode::Bicubic => {\n                panic!(\"bicubic interpolation backward is not supported for ndarray backend\")\n            }\n            InterpolateMode::Lanczos3 => {\n                panic!(\"lanczos3 interpolation backward is not supported for ndarray backend\")\n            }\n        }\n    }\n\n    fn conv3d(\n        x: FloatTensor<Self>,\n        weight: FloatTensor<Self>,\n        bias: Option<FloatTensor<Self>>,\n        options: ConvOptions<3>,\n    ) -> FloatTensor<Self> {\n        module_op!(inp(x, weight), opt(bias), E, |x, weight, bias| conv3d::<E>(\n            x, weight, bias, options","sourceCodeStart":338,"sourceCodeEnd":374,"githubUrl":"https://github.com/tracel-ai/burn/blob/d16f7ba2ed0d41408189384044cc886fb4c8f957/crates/burn-ndarray/src/ops/module.rs#L338-L374","documentation":"The burn-ndarray backend's interpolate_backward only implements backward for InterpolateMode::Nearest. When the interpolation mode is Bilinear, it panics because no gradient kernel exists for bilinear upsampling/downsampling in the ndarray backend. This is a hard panic, not a recoverable error.","triggerScenarios":"Calling backward through an interpolate (upsample) node created with InterpolateMode::Bilinear on the NdArray backend, e.g. training a model whose forward pass uses F.interpolate(..., mode=Bilinear) with burn-ndarray.","commonSituations":"Porting a PyTorch model that uses bilinear upsampling (e.g. segmentation networks like UNet, FPN decoders) to burn and trying to train it with the ndarray backend.","solutions":["Use InterpolateMode::Nearest instead of Bilinear when training on the ndarray backend","Switch to a backend with bilinear interpolation backward support (e.g. burn-cube/cubecl GPU backends or burn-torch)","Detach the interpolate node from the autodiff graph (e.g. mark no-grad) if gradients through it are not needed","Implement/register a bilinear backward kernel for the ndarray backend and submit upstream"],"exampleFix":"// before\nlet x = x.interpolate([h * 2, w * 2], InterpolateMode::Bilinear);\n// after (ndarray backend training)\nlet x = x.interpolate([h * 2, w * 2], InterpolateMode::Nearest);","handlingStrategy":"validation","validationCode":"if mode == InterpolateMode::Bilinear && cfg!(feature = \"ndarray\") {\n    // avoid autodiff through bilinear interpolate on ndarray\n}","typeGuard":"fn ndarray_supports_interpolate_backward(mode: &InterpolateMode) -> bool {\n    matches!(mode, InterpolateMode::Nearest)\n}","tryCatchPattern":null,"preventionTips":["Only use InterpolateMode::Nearest in training paths when targeting burn-ndarray","Add a startup assertion/check on the model config that validates interpolate modes against the active backend","Track burn release notes for ndarray interpolation backward support"],"tags":["rust","burn-ndarray","autodiff","unsupported-op"],"backgroundTag":"unsupported-op-backend","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"}