{"record":{"id":"56b74d53c0123f48","repo":"tracel-ai/burn","slug":"unsupported-dtype-other","errorCode":null,"errorMessage":"Unsupported dtype: {other:?}","messagePattern":"Unsupported dtype: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/burn-ndarray/src/ops/int_tensor.rs","lineNumber":400,"sourceCode":"\n    fn int_clamp(tensor: NdArrayTensor, min: Scalar, max: Scalar) -> NdArrayTensor {\n        execute_with_int_dtype!(tensor, |array| NdArrayMathOps::clamp(\n            array,\n            min.elem(),\n            max.elem()\n        ))\n    }\n\n    fn int_abs(tensor: NdArrayTensor) -> NdArrayTensor {\n        match tensor.dtype() {\n            DType::I64 | DType::I32 | DType::I16 | DType::I8 => {\n                execute_with_dtype!(tensor, I, NdArrayMathOps::abs, [\n                    I64 => i64, I32 => i32, I16 => i16, I8 => i8\n                ])\n            }\n            // Already unsigned\n            DType::U64 | DType::U32 | DType::U16 | DType::U8 => tensor,\n            other => panic!(\"Unsupported dtype: {other:?}\"),\n        }\n    }\n\n    fn int_into_float(tensor: NdArrayTensor, out_dtype: FloatDType) -> FloatTensor<Self> {\n        execute_with_float_out_dtype!(out_dtype, F, {\n            execute_with_int_dtype!(tensor, IntElem, |array: SharedArray<IntElem>| {\n                array.mapv(|a: IntElem| a.elem::<F>()).into_shared()\n            })\n        })\n    }\n\n    fn int_swap_dims(tensor: NdArrayTensor, dim1: usize, dim2: usize) -> NdArrayTensor {\n        execute_with_int_dtype!(tensor, |array| NdArrayOps::swap_dims(array, dim1, dim2))\n    }\n\n    fn int_random(\n        shape: Shape,\n        distribution: Distribution,","sourceCodeStart":382,"sourceCodeEnd":418,"githubUrl":"https://github.com/tracel-ai/burn/blob/d16f7ba2ed0d41408189384044cc886fb4c8f957/crates/burn-ndarray/src/ops/int_tensor.rs#L382-L418","documentation":"int_abs must dispatch the abs computation to the concrete integer type stored in the tensor. If the tensor's dtype is not one of the supported signed integer types (i64/i32/i16/i8) and not an unsigned type (returned as-is), the dtype is unexpected and the backend panics with 'Unsupported dtype'.","triggerScenarios":"Calling Tensor::abs on an Int tensor whose dtype falls outside the I64/I32/I16/I8/U64/U32/U16/U8 set — typically only possible with a mismatched/foreign dtype variant or an enum extended in a newer burn version without updating this match.","commonSituations":"Using a burn version where DType gained new variants while burn-ndarray's int_abs wasn't updated; dtype confusion after converting tensors across backends; bool tensors mis-typed as int.","solutions":["Ensure the int tensor uses a supported dtype (I64/I32/I16/I8 or unsigned, which is returned unchanged).","Cast the tensor to a supported int dtype (e.g. .int() / int cast to i32) before abs.","Upgrade or downgrade burn so the backend and core DType enum versions match.","Convert to float, take abs, and convert back as a workaround.","Report the missing dtype case to the burn repository if a legit variant is unhandled."],"exampleFix":"// before\nlet t: Tensor<_, Int, NdArray> = ...; // dtype not in supported set\nlet a = t.abs();\n// after\nlet t = t.cast(burn::tensor::DType::I32); // supported signed dtype\nlet a = t.abs();","handlingStrategy":"type-guard","validationCode":"assert!(matches!(t.dtype(), DType::I64 | DType::I32 | DType::I16 | DType::I8 | DType::U64 | DType::U32 | DType::U16 | DType::U8), \"abs: unsupported int dtype\");","typeGuard":"fn abs_supported(dt: DType) -> bool {\n    matches!(dt, DType::I64 | DType::I32 | DType::I16 | DType::I8\n        | DType::U64 | DType::U32 | DType::U16 | DType::U8)\n}","tryCatchPattern":null,"preventionTips":["Cast tensors to a supported int dtype before abs","Keep burn core and backend crate versions in sync","Check tensor.dtype() when migrating between backends"],"tags":["rust","burn","dtype","unsupported"],"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"}