tracel-ai/burn · error
todo!("CubeCL backend does not yet support adaptive_avg_pool
Error message
todo!("CubeCL backend does not yet support adaptive_avg_pool3d.") What it means
The CubeCL backend's `Backend` trait impl stubs out `adaptive_avg_pool3d` with `todo!` — 3D adaptive average pooling has no GPU/CubeCL kernel yet, so any call panics immediately. Only adaptive_avg_pool2d is implemented.
Source
Thrown at crates/burn-cubecl/src/ops/module.rs:296
padding,
dilation,
ceil_mode,
))
}
fn adaptive_avg_pool2d(x: FloatTensor<Self>, output_size: [usize; 2]) -> FloatTensor<Self> {
kernel::pool::adaptive_avg_pool2d(x, output_size)
}
fn adaptive_avg_pool2d_backward(
x: FloatTensor<Self>,
grad: FloatTensor<Self>,
) -> FloatTensor<Self> {
kernel::pool::adaptive_avg_pool2d_backward(x, grad)
}
fn adaptive_avg_pool3d(_x: FloatTensor<Self>, _output_size: [usize; 3]) -> FloatTensor<Self> {
todo!("CubeCL backend does not yet support adaptive_avg_pool3d.")
}
fn adaptive_avg_pool3d_backward(
_x: FloatTensor<Self>,
_grad: FloatTensor<Self>,
) -> FloatTensor<Self> {
todo!("CubeCL backend does not yet support adaptive_avg_pool3d_backward.")
}
fn interpolate(
x: FloatTensor<Self>,
output_size: [usize; 2],
options: InterpolateOptions,
) -> FloatTensor<Self> {
kernel::interpolate::interpolate(x, output_size, options, Default::default()).unwrap()
}
fn interpolate_backward(View on GitHub (pinned to d16f7ba2ed)
Solutions
- Replace AdaptiveAvgPool3d with a fixed-size avg_pool3d (compute kernel/stride manually per output size).
- Dequantize—rather, run the 3D pooling layer on the NdArray (CPU) backend and the rest on GPU, combining results.
- Implement the op via average_pool3d composition (multiple pooled crops + interpolation).
- Check upstream burn for a recent implementation or open an issue.
Example fix
// before let out = x.adaptive_avg_pool3d([4, 4, 4]); // panics on CubeCL // after let out = x.avg_pool3d([2, 2, 2], [2, 2, 2], [0, 0, 0], false); // fixed pooling equivalent
Defensive patterns
Strategy: fallback
Validate before calling
fn supports_adaptive_pool3d<B: Backend>() -> bool {
// CubeCL does not implement adaptive_avg_pool3d; only use on backends that do
std::any::type_name::<B>().contains("NdArray")
} Try / catch
// panic-based todo!, cannot be caught; pre-check backend instead
if !supports_adaptive_pool3d::<B>() {
let out = x.avg_pool3d(kernel, stride, pad, false); // equivalent fixed pooling
} Prevention
- Replace AdaptiveAvgPool3d with equivalent fixed avg_pool3d when targeting GPU backends.
- Keep 3D pooling layers on CPU backend if architecture allows.
- Search burn issues for the op before porting 3D models.
- Add a startup feature-check for ops your model needs.
When it happens
Trigger: Calling `Tensor::adaptive_avg_pool3d` (or a module/layer using it, e.g. 3D adaptive pooling heads in vision models) while running on the CubeCL (WGPU/CUDA) backend.
Common situations: Running 3D segmentation/video models (e.g. adaptive-pool heads in spatial pyramid pooling 3D) on GPU; porting a 2D model to 3D and hitting the missing op; wgpu/CUDA users converting models containing AdaptiveAvgPool3d from PyTorch.
Related errors
- todo!("CubeCL backend does not yet support adaptive_avg_pool
- int_scatter with {other:?} update is not implemented
- int_select_assign with {other:?} update is not implemented
- unimplemented!()
- float_scatter with {other:?} update is not implemented
AI-assisted analysis of tracel-ai/burn@d16f7ba2ed (2026-09-05).
Data as JSON: /api/errors/321c83515f03f303.
Report an issue: GitHub.