{"record":{"id":"b9e895d2478de8c0","repo":"tracel-ai/burn","slug":"conv3d-unsupported-dtype","errorCode":null,"errorMessage":"conv3d: unsupported dtype {:?}","messagePattern":"conv3d: unsupported dtype (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/burn-flex/src/ops/module.rs","lineNumber":259,"sourceCode":"                )\n            }\n            dtype => panic!(\"deform_conv2d_backward: unsupported dtype {:?}\", dtype),\n        };\n        DeformConv2dBackward::new(x_grad, offset_grad, weight_grad, mask_grad, bias_grad)\n    }\n\n    fn conv3d(\n        x: FloatTensor<Flex>,\n        weight: FloatTensor<Flex>,\n        bias: Option<FloatTensor<Flex>>,\n        options: ConvOptions<3>,\n    ) -> FloatTensor<Flex> {\n        match x.dtype() {\n            DType::F32 => conv::conv3d_f32(x, weight, bias, &options),\n            DType::F64 => conv::conv3d_f64(x, weight, bias, &options),\n            DType::F16 => conv::conv3d_f16(x, weight, bias, &options),\n            DType::BF16 => conv::conv3d_bf16(x, weight, bias, &options),\n            dtype => panic!(\"conv3d: unsupported dtype {:?}\", dtype),\n        }\n    }\n\n    fn conv_transpose1d(\n        x: FloatTensor<Flex>,\n        weight: FloatTensor<Flex>,\n        bias: Option<FloatTensor<Flex>>,\n        options: ConvTransposeOptions<1>,\n    ) -> FloatTensor<Flex> {\n        match x.dtype() {\n            DType::F32 => conv_transpose::conv_transpose1d_f32(x, weight, bias, &options),\n            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","sourceCodeStart":241,"sourceCodeEnd":277,"githubUrl":"https://github.com/tracel-ai/burn/blob/d16f7ba2ed0d41408189384044cc886fb4c8f957/crates/burn-flex/src/ops/module.rs#L241-L277","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nlet out = conv3d(ct_voxels_i16, weight, bias, options);\n// panic: conv3d: unsupported dtype I16\n\n// after\nlet x = ct_voxels_i16.cast(burn::tensor::DType::F32);\nlet out = conv3d(x, weight, bias, options);","handlingStrategy":"validation","validationCode":"if !matches!(x.dtype(), DType::F32 | DType::F64 | DType::F16 | DType::BF16) {\n    x = x.cast(DType::F32);\n}\nlet out = conv3d(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 out = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| conv3d(x.clone(), w.clone(), b.clone(), opts.clone())))\n    .unwrap_or_else(|_| conv3d(x.cast(DType::F32), w, b, opts));","preventionTips":["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."],"tags":["burn","dtype","panic","conv","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"}