{"record":{"id":"3440be006f07ce1e","repo":"tracel-ai/burn","slug":"conv-transpose2d-unsupported-dtype","errorCode":null,"errorMessage":"conv_transpose2d: unsupported dtype {:?}","messagePattern":"conv_transpose2d: unsupported dtype (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/burn-flex/src/ops/module.rs","lineNumber":289,"sourceCode":"            DType::F64 => conv_transpose::conv_transpose1d_f64(x, weight, bias, &options),\n            DType::F16 => conv_transpose::conv_transpose1d_f16(x, weight, bias, &options),\n            DType::BF16 => conv_transpose::conv_transpose1d_bf16(x, weight, bias, &options),\n            dtype => panic!(\"conv_transpose1d: unsupported dtype {:?}\", dtype),\n        }\n    }\n\n    fn conv_transpose2d(\n        x: FloatTensor<Flex>,\n        weight: FloatTensor<Flex>,\n        bias: Option<FloatTensor<Flex>>,\n        options: ConvTransposeOptions<2>,\n    ) -> FloatTensor<Flex> {\n        match x.dtype() {\n            DType::F32 => conv_transpose::conv_transpose2d_f32(x, weight, bias, &options),\n            DType::F64 => conv_transpose::conv_transpose2d_f64(x, weight, bias, &options),\n            DType::F16 => conv_transpose::conv_transpose2d_f16(x, weight, bias, &options),\n            DType::BF16 => conv_transpose::conv_transpose2d_bf16(x, weight, bias, &options),\n            dtype => panic!(\"conv_transpose2d: unsupported dtype {:?}\", dtype),\n        }\n    }\n\n    fn conv_transpose3d(\n        x: FloatTensor<Flex>,\n        weight: FloatTensor<Flex>,\n        bias: Option<FloatTensor<Flex>>,\n        options: ConvTransposeOptions<3>,\n    ) -> FloatTensor<Flex> {\n        match x.dtype() {\n            DType::F32 => conv_transpose::conv_transpose3d_f32(x, weight, bias, &options),\n            DType::F64 => conv_transpose::conv_transpose3d_f64(x, weight, bias, &options),\n            DType::F16 => conv_transpose::conv_transpose3d_f16(x, weight, bias, &options),\n            DType::BF16 => conv_transpose::conv_transpose3d_bf16(x, weight, bias, &options),\n            dtype => panic!(\"conv_transpose3d: unsupported dtype {:?}\", dtype),\n        }\n    }\n","sourceCodeStart":271,"sourceCodeEnd":307,"githubUrl":"https://github.com/tracel-ai/burn/blob/d16f7ba2ed0d41408189384044cc886fb4c8f957/crates/burn-flex/src/ops/module.rs#L271-L307","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nlet up = conv_transpose2d(quantized_features_i8, weight, bias, options);\n// panic: conv_transpose2d: unsupported dtype I8\n\n// after\nlet x = quantized_features_i8.cast(burn::tensor::DType::F32);\nlet up = conv_transpose2d(x, weight, bias, options);","handlingStrategy":"validation","validationCode":"let x = if is_supported_float(x.dtype()) { x } else { x.cast(DType::F32) };\nfn is_supported_float(d: DType) -> bool { matches!(d, DType::F32 | DType::F64 | DType::F16 | DType::BF16) }\nlet up = conv_transpose2d(x, weight, bias, options);","typeGuard":"fn is_float(t: &Tensor<Flex>) -> bool {\n    matches!(t.dtype(), DType::F32 | DType::F64 | DType::F16 | DType::BF16)\n}","tryCatchPattern":"let up = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| conv_transpose2d(x.clone(), w.clone(), b.clone(), opts.clone())))\n    .unwrap_or_else(|_| conv_transpose2d(x.cast(DType::F32), w, b, opts));","preventionTips":["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."],"tags":["burn","dtype","panic","conv-transpose","backend"],"backgroundTag":"unsupported-dtype","analyzedSha":"d16f7ba2ed0d41408189384044cc886fb4c8f957","analyzedAt":"2026-09-05T13:19:14.260Z","contentChangedAt":"2026-09-05T13:19:14.260Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}