{"record":{"id":"60c6f0d830f0ec85","repo":"tracel-ai/burn","slug":"unsupported-dtype","errorCode":null,"errorMessage":"Unsupported dtype: {:?}","messagePattern":"Unsupported dtype: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/burn-ndarray/src/tensor.rs","lineNumber":315,"sourceCode":"#[macro_export]\nmacro_rules! cat_with_dtype {\n    ($tensors: expr, $dim: expr, [$($dtype: ident),*]) => {\n        match &$tensors[0] {\n            $(NdArrayTensor::$dtype(_) => {\n                let tensors = $tensors\n                    .iter()\n                    .map(|t| {\n                        if let NdArrayTensor::$dtype(storage) = t {\n                            // Use storage.view() for zero-copy access\n                            storage.view()\n                        } else {\n                            panic!(\"Concatenate data type mismatch (expected {:?}, got {:?})\", $tensors[0].dtype(), t.dtype())\n                        }\n                    })\n                    .collect::<Vec<_>>();\n                NdArrayOps::concatenate(&tensors, $dim).into()\n            })*\n            _ => panic!(\"Unsupported dtype: {:?}\", $tensors[0].dtype())\n        }\n    };\n}\n\n/// Macro to execute an operation that returns a given element type.\n#[macro_export]\nmacro_rules! execute_with_float_out_dtype {\n    ($out_dtype:expr, $element:ident, $op:expr, [$($dtype: ident => $ty: ty),*]) => {{\n        match $out_dtype {\n            $(\n                burn_std::FloatDType::$dtype => {\n                    #[allow(unused)]\n                    type $element = $ty;\n                    $op\n                }\n            )*\n            #[allow(unreachable_patterns)]\n            other => unimplemented!(\"unsupported dtype: {other:?}\")","sourceCodeStart":297,"sourceCodeEnd":333,"githubUrl":"https://github.com/tracel-ai/burn/blob/d16f7ba2ed0d41408189384044cc886fb4c8f957/crates/burn-ndarray/src/tensor.rs#L297-L333","documentation":"Fallback arm of the ndarray concatenate macro: when the first tensor's dtype doesn't match any supported storage variant the macro generates, it panics with 'Unsupported dtype'. This differs from 336 — here even the expected/first dtype isn't representable.","triggerScenarios":"Calling cat/concatenate on ndarray tensors whose dtype is outside the macro's generated set (e.g. QFloat, BF16, or non-native Bool storage).","commonSituations":"Concatenating quantized or half-precision tensors on ndarray; version churn introducing new DType variants not yet covered by the macro.","solutions":["Dequantize/cast tensors to a supported dtype (F32 etc.) before concatenating","Use Bool(BoolStore::Native) for bool tensors","Upgrade burn to a version that covers the dtype, or avoid concatenating exotic dtypes"],"exampleFix":"// before\nTensor::cat(quantized_tensors, 0); // QFloat unsupported\n// after\nlet floats: Vec<_> = quantized_tensors.iter().map(|t| t.cast(DType::F32)).collect();\nTensor::cat(floats, 0);","handlingStrategy":"validation","validationCode":"assert!(!matches!(tensors[0].dtype(), DType::QFloat | _), \"cast to supported dtype first\");","typeGuard":"fn cat_supported<T: TensorOps>(ts: &[T]) -> bool {\n    matches!(ts[0].dtype(), DType::F32 | DType::I32 | DType::U8 /* supported set */)\n}","tryCatchPattern":null,"preventionTips":["Dequantize before concat on ndarray","Avoid concatenating BF16/QFloat tensors on ndarray"],"tags":["rust","burn-ndarray","dtype","concat"],"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"}