tracel-ai/burn · error
interpolate_backward kernel failed (device={0:?}, dtype={1:?
Error message
interpolate_backward kernel failed (device={0:?}, dtype={1:?}, options={2:?}): {3} What it means
This panic occurs when the backward-pass interpolation (upsampling gradient) kernel fails to launch on the CubeCL backend. It reports the input device, dtype, and the mapped interpolation options alongside the underlying error, since launch failures are fatal to the autodiff step.
Source
Thrown at crates/burn-cubecl/src/kernel/interpolate/base.rs:125
let output_shape = input.shape();
let output = empty_device_dtype(
input.client.clone(),
input.device.clone(),
output_shape,
input.dtype,
);
cubek_interpolate_backward(
&input.client.clone(),
input.clone().binding(),
out_grad.binding(),
output.clone().binding(),
map_options(options.clone()),
dtype_to_storage_type(input.dtype),
)
.unwrap_or_else(|e| {
panic!(
"interpolate_backward kernel failed (device={0:?}, dtype={1:?}, options={2:?}): {3}",
input.device, input.dtype, options, e
)
});
permute_nhwc_to_nchw(output)
}
pub(crate) fn map_mode(mode: InterpolateMode) -> CubekInterpolateMode {
match mode {
InterpolateMode::Nearest => CubekInterpolateMode::Nearest(CubekNearestMode::Floor),
InterpolateMode::NearestExact => CubekInterpolateMode::Nearest(CubekNearestMode::Exact),
InterpolateMode::Bilinear => CubekInterpolateMode::Bilinear,
InterpolateMode::Bicubic => CubekInterpolateMode::Bicubic,
InterpolateMode::Lanczos3 => CubekInterpolateMode::Lanczos3,
}
}
View on GitHub (pinned to d16f7ba2ed)
Solutions
- Inspect the wrapped error for the concrete launch failure
- Ensure output_grad shape matches the forward output shape used in interpolate
- Use a dtype supported by the interpolate kernels (f32 is safest) on the current device
- Test the forward interpolate on the same device/dtype first to confirm kernel availability
Example fix
// before: f16 backward on unsupported device let grad_out = interpolate_backward(grad, output, options); // panics // after: cast to f32 let grad = grad.cast(DType::F32); let grad_out = interpolate_backward(grad, output.cast(DType::F32), options);
Defensive patterns
Strategy: validation
Validate before calling
assert_eq!(grad.shape(), output.shape(), "output_grad must match forward output shape"); assert!(matches!(input.dtype, DType::F32 | DType::F16), "unsupported interpolate dtype");
Prevention
- Run the forward interpolate once at startup to verify kernel availability
- Keep grad/output shapes paired through your autodiff plumbing
- Prefer f32 for training-time interpolate ops
When it happens
Trigger: Backward pass of interpolate with an unsupported dtype/device combination, an output_grad whose shape is inconsistent with the recorded output shape, or a backend kernel-compile error for the chosen interpolation mode/algorithm.
Common situations: Training models with F.interpolate on GPU where f16 kernels aren't available, or shapes changed between forward and backward due to incorrect tensor plumbing.
Related errors
- irfft kernel launch failed (device={input_device:?}, dtype={
- {0} kernel failed (device={1:?}, dtype={2:?}): {3}
- interpolate_backward: unsupported mode {:?} / dtype {:?}
- Not a valid DType for tensors.
- Invalid concreate ref layout
AI-assisted analysis of tracel-ai/burn@d16f7ba2ed (2026-09-05).
Data as JSON: /api/errors/22a18ddf8713058a.
Report an issue: GitHub.