tracel-ai/burn · error
conv3d: unsupported dtype {:?}
Error message
conv3d: unsupported dtype {:?} What it means
conv3d in the burn-flex module ops dispatches on the input dtype to conv3d_f32/f64/f16/bf16 implementations; any other dtype reaches the catch-all panic. Like the other conv ops, it only accepts float tensors, but because Flex is dynamically typed the mismatch is only caught at runtime.
Source
Thrown at crates/burn-flex/src/ops/module.rs:259
)
}
dtype => panic!("deform_conv2d_backward: unsupported dtype {:?}", dtype),
};
DeformConv2dBackward::new(x_grad, offset_grad, weight_grad, mask_grad, bias_grad)
}
fn conv3d(
x: FloatTensor<Flex>,
weight: FloatTensor<Flex>,
bias: Option<FloatTensor<Flex>>,
options: ConvOptions<3>,
) -> FloatTensor<Flex> {
match x.dtype() {
DType::F32 => conv::conv3d_f32(x, weight, bias, &options),
DType::F64 => conv::conv3d_f64(x, weight, bias, &options),
DType::F16 => conv::conv3d_f16(x, weight, bias, &options),
DType::BF16 => conv::conv3d_bf16(x, weight, bias, &options),
dtype => panic!("conv3d: unsupported dtype {:?}", dtype),
}
}
fn conv_transpose1d(
x: FloatTensor<Flex>,
weight: FloatTensor<Flex>,
bias: Option<FloatTensor<Flex>>,
options: ConvTransposeOptions<1>,
) -> FloatTensor<Flex> {
match x.dtype() {
DType::F32 => conv_transpose::conv_transpose1d_f32(x, weight, bias, &options),
DType::F64 => conv_transpose::conv_transpose1d_f64(x, weight, bias, &options),
DType::F16 => conv_transpose::conv_transpose1d_f16(x, weight, bias, &options),
DType::BF16 => conv_transpose::conv_transpose1d_bf16(x, weight, bias, &options),
dtype => panic!("conv_transpose1d: unsupported dtype {:?}", dtype),
}
}
View on GitHub (pinned to d16f7ba2ed)
Solutions
- Cast the input to float before conv3d: x.cast(DType::F32) (normalize u8 voxel data while casting).
- Print/inspect .dtype() on the input and weights just before the call to find the offending tensor.
- Fix the data loader to emit f32 (or bf16) tensors instead of raw integer volumes.
- If another dtype is legitimately required, add a matching arm (e.g. conv3d_i16 with cast) in crates/burn-flex/src/ops/module.rs.
Example fix
// before let out = conv3d(ct_voxels_i16, weight, bias, options); // panic: conv3d: unsupported dtype I16 // after let x = ct_voxels_i16.cast(burn::tensor::DType::F32); let out = conv3d(x, weight, bias, options);
Defensive patterns
Strategy: validation
Validate before calling
if !matches!(x.dtype(), DType::F32 | DType::F64 | DType::F16 | DType::BF16) {
x = x.cast(DType::F32);
}
let out = conv3d(x, weight, bias, options); Type guard
fn is_float(t: &Tensor<Flex>) -> bool {
matches!(t.dtype(), DType::F32 | DType::F64 | DType::F16 | DType::BF16)
} Try / catch
let out = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| conv3d(x.clone(), w.clone(), b.clone(), opts.clone())))
.unwrap_or_else(|_| conv3d(x.cast(DType::F32), w, b, opts)); Prevention
- Fix data loaders (DICOM/video) to emit f32 volumes, not raw int16/u8.
- Normalize-and-cast at ingestion, not at each layer.
- Check voxel tensor dtype in an integration test before model forward.
- Keep weights and input dtypes consistent when mixing checkpoints.
When it happens
Trigger: Calling conv3d (or a Conv3d module forward) with a non-float input tensor: I8/I16/I32/I64/U8/Bool/etc.; passing volumetric video/medical data loaded as u8/int16 arrays without conversion.
Common situations: 3D medical imaging (CT/MRI) pipelines loading DICOM voxels as int16 and feeding them to a conv3d model; video models consuming uint8 frame volumes; quantized 3D networks missing a dequant step.
Related errors
- conv1d: unsupported dtype {:?}
- conv2d: unsupported dtype {:?}
- float_storage_as_f32: unsupported dtype {:?}
- deform_conv2d: unsupported dtype {:?}
- deform_conv2d_backward: unsupported dtype {:?}
AI-assisted analysis of tracel-ai/burn@d16f7ba2ed (2026-09-05).
Data as JSON: /api/errors/b9e895d2478de8c0.
Report an issue: GitHub.