tracel-ai/burn · error
bicubic interpolation backward is not supported for ndarray
Error message
bicubic interpolation backward is not supported for ndarray backend
What it means
interpolate_backward in the ndarray backend has no backward implementation for InterpolateMode::Bicubic and panics. Bicubic resizing gradients are simply not implemented for this CPU backend. Only Nearest mode backward is supported.
Source
Thrown at crates/burn-ndarray/src/ops/module.rs:359
fn interpolate_backward(
x: FloatTensor<Self>,
grad: FloatTensor<Self>,
output_size: [usize; 2],
options: InterpolateOptions,
) -> FloatTensor<Self> {
match options.mode {
InterpolateMode::Nearest => module_op!(inp(x, grad), opt(), E, |x, grad| {
nearest_interpolate_backward::<E>(x, grad, output_size).into()
}),
InterpolateMode::NearestExact => {
panic!("nearest exact interpolation backward is not supported for ndarray backend")
}
InterpolateMode::Bilinear => {
panic!("bilinear interpolation backward is not supported for ndarray backend")
}
InterpolateMode::Bicubic => {
panic!("bicubic interpolation backward is not supported for ndarray backend")
}
InterpolateMode::Lanczos3 => {
panic!("lanczos3 interpolation backward is not supported for ndarray backend")
}
}
}
fn conv3d(
x: FloatTensor<Self>,
weight: FloatTensor<Self>,
bias: Option<FloatTensor<Self>>,
options: ConvOptions<3>,
) -> FloatTensor<Self> {
module_op!(inp(x, weight), opt(bias), E, |x, weight, bias| conv3d::<E>(
x, weight, bias, options
)
.into())
}View on GitHub (pinned to d16f7ba2ed)
Solutions
- Use InterpolateMode::Nearest, which has a backward pass on ndarray
- Switch backends (burn-cube/cubecl or burn-torch) which support bicubic backward
- Keep bicubic only in inference paths outside the autodiff graph
Defensive patterns
Strategy: validation
Validate before calling
if mode == InterpolateMode::Bicubic && backend_is_ndarray() { /* reconfigure */ } Type guard
fn supports_backward(mode: &InterpolateMode) -> bool {
matches!(mode, InterpolateMode::Nearest)
} Prevention
- Keep bicubic resampling in inference-only preprocessing
- Prefer Nearest for trainable upsample layers on ndarray
When it happens
Trigger: Backpropagating through an interpolate node with InterpolateMode::Bicubic while using burn-ndarray as the backend.
Common situations: Training image super-resolution or generative models that use bicubic upsampling layers on the ndarray CPU backend.
Related errors
- bilinear interpolation backward is not supported for ndarray
- lanczos3 interpolation backward is not supported for ndarray
- nearest exact interpolation backward is not supported for nd
- Can't differentiate avg pool 2d backward.
- Can't differentiate max pool2d with indices backward.
AI-assisted analysis of tracel-ai/burn@d16f7ba2ed (2026-09-05).
Data as JSON: /api/errors/93aa682cedae81d8.
Report an issue: GitHub.