{"record":{"id":"98c9184c9c503f0c","repo":"tracel-ai/burn","slug":"unsupported-dtype-other-98c918","errorCode":null,"errorMessage":"unsupported dtype: {other:?}","messagePattern":"unsupported dtype: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/burn-ndarray/src/tensor.rs","lineNumber":333,"sourceCode":"            _ => 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:?}\")\n        }\n    }};\n    // Unary op: type automatically inferred by the compiler\n    ($out_dtype:expr, $op:expr) => {{\n        $crate::execute_with_float_out_dtype!($out_dtype, E, $op)\n    }};\n\n    // Unary op: generic type cannot be inferred for an operation\n    ($out_dtype:expr, $element:ident, $op:expr) => {{\n        $crate::execute_with_float_out_dtype!($out_dtype, $element, $op, [\n            F64 => f64, F32 => f32\n        ])\n    }};\n}\n\n/// Macro to execute an operation that returns a given element type.\n#[macro_export]\nmacro_rules! execute_with_int_out_dtype {","sourceCodeStart":315,"sourceCodeEnd":351,"githubUrl":"https://github.com/tracel-ai/burn/blob/d16f7ba2ed0d41408189384044cc886fb4c8f957/crates/burn-ndarray/src/tensor.rs#L315-L351","documentation":"Same family as error 420 but from `execute_with_float_out_dtype!`: a float-output op in the ndarray backend dispatches on the requested out dtype, and the catch-all `other` arm panics because no float arm matches. The macro only expands arms for the float element types the backend supports.","triggerScenarios":"Invoking a float op (e.g. matmul, activation) via this macro with a float out-dtype not covered by the macro arms, such as F64 or F16 with an ndarray backend compiled only for F32.","commonSituations":"Running float64 training/inference on the CPU ndarray backend; using a half-precision model without enabling the corresponding backend feature; dtype inferred from input data files (e.g. f64 numpy arrays).","solutions":["Use F32 tensors (the default supported float dtype) for the operation.","Enable the backend feature for the needed float dtype if available.","Cast inputs and specify a supported out dtype (`.cast(DType::F32)`).","Verify model export settings so weights are stored as f32."],"exampleFix":"// before\nlet out = tensor_f64 + other_f64;\n// after\nlet out = tensor_f64.cast(DType::F32) + other_f64.cast(DType::F32);","handlingStrategy":"validation","validationCode":"fn assert_float_out_dtype(d: DType) -> bool {\n    matches!(d, DType::F32) // extend per your backend's enabled features\n}\nlet out = if assert_float_out_dtype(input.dtype()) { input.clone() } else { input.cast(DType::F32) };","typeGuard":"fn is_f32(d: DType) -> bool { matches!(d, DType::F32) }","tryCatchPattern":null,"preventionTips":["Standardize on F32 for float math unless a feature explicitly enables F64/F16.","Cast model weights to f32 at export time.","Verify checkpoint dtypes before loading.","Keep dtype configuration in one place so checks are centralized."],"tags":["burn","dtype","float","panic"],"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"}