tracel-ai/burn · error
conv_transpose2d: unsupported dtype {:?}
Error message
conv_transpose2d: unsupported dtype {:?} What it means
conv_transpose2d in the burn-flex module ops dispatches the input dtype to conv_transpose2d_f32/f64/f16/bf16; any other dtype hits the catch-all panic. This op appears in decoder/upsampling stages of segmentation and GAN models, so the failure usually happens on the decoder side when a tensor has lost its float dtype upstream.
Source
Thrown at crates/burn-flex/src/ops/module.rs:289
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),
}
}
fn conv_transpose2d(
x: FloatTensor<Flex>,
weight: FloatTensor<Flex>,
bias: Option<FloatTensor<Flex>>,
options: ConvTransposeOptions<2>,
) -> FloatTensor<Flex> {
match x.dtype() {
DType::F32 => conv_transpose::conv_transpose2d_f32(x, weight, bias, &options),
DType::F64 => conv_transpose::conv_transpose2d_f64(x, weight, bias, &options),
DType::F16 => conv_transpose::conv_transpose2d_f16(x, weight, bias, &options),
DType::BF16 => conv_transpose::conv_transpose2d_bf16(x, weight, bias, &options),
dtype => panic!("conv_transpose2d: unsupported dtype {:?}", dtype),
}
}
fn conv_transpose3d(
x: FloatTensor<Flex>,
weight: FloatTensor<Flex>,
bias: Option<FloatTensor<Flex>>,
options: ConvTransposeOptions<3>,
) -> FloatTensor<Flex> {
match x.dtype() {
DType::F32 => conv_transpose::conv_transpose3d_f32(x, weight, bias, &options),
DType::F64 => conv_transpose::conv_transpose3d_f64(x, weight, bias, &options),
DType::F16 => conv_transpose::conv_transpose3d_f16(x, weight, bias, &options),
DType::BF16 => conv_transpose::conv_transpose3d_bf16(x, weight, bias, &options),
dtype => panic!("conv_transpose3d: unsupported dtype {:?}", dtype),
}
}
View on GitHub (pinned to d16f7ba2ed)
Solutions
- Cast the input to float before conv_transpose2d: x.cast(DType::F32).
- Confirm the encoder half of the network outputs a float dtype; add explicit casts at stage boundaries if needed.
- Inspect .dtype() on the input and weight tensors immediately before the call to find the culprit.
- If a dtype should be supported, extend the match in crates/burn-flex/src/ops/module.rs conv_transpose2d.
Example fix
// before let up = conv_transpose2d(quantized_features_i8, weight, bias, options); // panic: conv_transpose2d: unsupported dtype I8 // after let x = quantized_features_i8.cast(burn::tensor::DType::F32); let up = conv_transpose2d(x, weight, bias, options);
Defensive patterns
Strategy: validation
Validate before calling
let x = if is_supported_float(x.dtype()) { x } else { x.cast(DType::F32) };
fn is_supported_float(d: DType) -> bool { matches!(d, DType::F32 | DType::F64 | DType::F16 | DType::BF16) }
let up = conv_transpose2d(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 up = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| conv_transpose2d(x.clone(), w.clone(), b.clone(), opts.clone())))
.unwrap_or_else(|_| conv_transpose2d(x.cast(DType::F32), w, b, opts)); Prevention
- Ensure encoder outputs stay float through skip connections into the decoder.
- Never feed integer label maps into upsampling paths — cast first.
- Dequantize int8 decoder features before conv_transpose2d.
- Add a dtype check test around the full encode-decode pipeline.
When it happens
Trigger: Calling conv_transpose2d with non-float input (I8/I32/U8/Bool/etc.); feeding quantized decoder activations or mask/label tensors (int labels) into the upsampling path.
Common situations: Segmentation decoders accidentally receiving integer label maps; int8-quantized generator networks missing dequantization; model-export tools (ONNX/safetensors) preserving integer dtypes the runtime doesn't expect.
Related errors
- conv_transpose1d: unsupported dtype {:?}
- conv_transpose3d: unsupported dtype {:?}
- float_storage_as_f32: unsupported dtype {:?}
- conv1d: unsupported dtype {:?}
- conv2d: unsupported dtype {:?}
AI-assisted analysis of tracel-ai/burn@d16f7ba2ed (2026-09-05).
Data as JSON: /api/errors/3440be006f07ce1e.
Report an issue: GitHub.