tracel-ai/burn · error
lanczos3 interpolation backward is not supported by PyTorch/
Error message
lanczos3 interpolation backward is not supported by PyTorch/tch backend
What it means
The burn-tch backend does not implement the backward pass for Lanczos3 interpolation; LibTorch exposes no lanczos upsampling backward, so the backend panics. Forward Lanczos3 is likewise unsupported in tch (module.rs:433). It is an unimplemented-feature panic, hit only during gradient computation.
Source
Thrown at crates/burn-tch/src/ops/module.rs:481
}
InterpolateMode::Bilinear => tch::Tensor::upsample_bilinear2d_backward(
&grad.tensor,
output_size,
input_size,
align_corners,
None,
None,
),
InterpolateMode::Bicubic => tch::Tensor::upsample_bicubic2d_backward(
&grad.tensor,
output_size,
input_size,
align_corners,
None,
None,
),
InterpolateMode::Lanczos3 => {
panic!("lanczos3 interpolation backward is not supported by PyTorch/tch backend")
}
};
TchTensor::new(tensor)
}
fn attention(
query: TchTensor,
key: TchTensor,
value: TchTensor,
mask: Option<TchTensor>,
attn_bias: Option<TchTensor>,
options: AttentionModuleOptions,
) -> TchTensor {
if attn_bias.is_some() {
return attention_fallback::<Self>(query, key, value, mask, attn_bias, options);
}
View on GitHub (pinned to d16f7ba2ed)
Solutions
- Change the interpolate mode to Bilinear or Bicubic, which have supported tch backward kernels
- Use InterpolateMode::Nearest if exactness of lanczos filtering is not required
- Run the training/backward graph on a backend that implements Lanczos3 (e.g. burn-cube/wgpu) and keep tch for inference only
- Validate the interpolation mode against the selected backend at startup and fail early with a clear message
Example fix
// before let options = InterpolateOptions::new(InterpolateMode::Lanczos3); // after let options = InterpolateOptions::new(InterpolateMode::Bicubic);
Defensive patterns
Strategy: validation
Validate before calling
fn ensure_interpolate_backward_supported(options: &InterpolateOptions) {
match options.mode {
InterpolateMode::Lanczos3 | InterpolateMode::NearestExact => {
panic!("mode {:?} has no backward in burn-tch; use Nearest/Bilinear/Bicubic", options.mode)
}
_ => {}
}
} Try / catch
let result = std::panic::catch_unwind(|| loss.backward());
if result.is_err() {
eprintln!("unsupported interpolation backward; rebuild graph with Bicubic");
} Prevention
- Restrict training configs to modes with tch backward support: Nearest, Bilinear, Bicubic
- Keep Lanczos3 configs separate per backend (inference-only on tch)
- Test backward passes of resize layers whenever you change backend
- Validate InterpolateOptions against the backend before constructing the training loop
When it happens
Trigger: Backward pass of an interpolate/upsample op configured with InterpolateOptions { mode: InterpolateMode::Lanczos3 } under the tch (LibTorch) backend — i.e. training or grad computation on a resize layer set to lanczos3.
Common situations: Reusing a configuration or model definition written for a backend that supports Lanczos3 (e.g. burn-cube/wgpu) and then training it on burn-tch; switching backends for GPU/CPU training without revisiting interpolation settings.
Related errors
- nearest exact interpolation backward is not supported by PyT
- Can't use deformable convolution backwards pass without atom
- nearest exact interpolation is not supported by PyTorch/tch
- lanczos3 interpolation is not supported by PyTorch/tch backe
- Not a valid float kind
AI-assisted analysis of tracel-ai/burn@d16f7ba2ed (2026-09-05).
Data as JSON: /api/errors/ef4c64fe358cb9fb.
Report an issue: GitHub.