{"record":{"id":"fc321b4584f36785","repo":"tracel-ai/burn","slug":"unsupported-dtype-for-bool-from-data-other","errorCode":null,"errorMessage":"Unsupported dtype for `bool_from_data` {other:?}","messagePattern":"Unsupported dtype for `bool_from_data` (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/burn-cubecl/src/ops/bool_tensor.rs","lineNumber":112,"sourceCode":"    }\n\n    fn bool_equal(lhs: BoolTensor<Self>, rhs: BoolTensor<Self>) -> BoolTensor<Self> {\n        let dtype = lhs.dtype;\n        kernel::equal(lhs, rhs, dtype)\n    }\n\n    fn bool_not_equal(lhs: BoolTensor<Self>, rhs: BoolTensor<Self>) -> BoolTensor<Self> {\n        let dtype = lhs.dtype;\n        kernel::not_equal(lhs, rhs, dtype)\n    }\n\n    fn bool_not(tensor: BoolTensor<Self>) -> BoolTensor<Self> {\n        let dtype = tensor.dtype;\n        let storage = dtype_to_storage_type(dtype);\n        let scalar = match dtype {\n            DType::Bool(BoolStore::U32) => InputScalar::new(u32::false_val(), storage),\n            DType::Bool(BoolStore::U8) => InputScalar::new(u8::false_val(), storage),\n            other => unimplemented!(\"Unsupported dtype for `bool_from_data` {other:?}\"),\n        };\n        kernel::equal_elem(tensor, scalar, dtype)\n    }\n\n    fn bool_and(lhs: BoolTensor<Self>, rhs: BoolTensor<Self>) -> BoolTensor<Self> {\n        kernel::launch_binop::<AndOp>(lhs, rhs)\n    }\n\n    fn bool_or(lhs: BoolTensor<Self>, rhs: BoolTensor<Self>) -> BoolTensor<Self> {\n        kernel::launch_binop::<OrOp>(lhs, rhs)\n    }\n\n    fn bool_any(tensor: BoolTensor<Self>) -> BoolTensor<Self> {\n        let store = bool_store(&tensor);\n        kernel::reduce::reduce_logical(tensor, None, ReduceOperationConfig::Any, store)\n    }\n\n    fn bool_any_dim(tensor: BoolTensor<Self>, dim: usize) -> BoolTensor<Self> {","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/tracel-ai/burn/blob/d16f7ba2ed0d41408189384044cc886fb4c8f957/crates/burn-cubecl/src/ops/bool_tensor.rs#L94-L130","documentation":"bool_not implements logical NOT by comparing the tensor against a typed false scalar; the scalar must match the tensor's storage dtype. Only Bool(U32) and Bool(U8) storages are handled; any other dtype reaching bool_not panics with this unimplemented! (note: the message text says bool_from_data due to a copy-paste in the source).","triggerScenarios":"Calling bool_not (tensor logical not) on a boolean tensor whose dtype is not DType::Bool with U8/U32 storage — e.g. Bool(BoolStore::Native) arriving from another backend or malformed construction.","commonSituations":"Mixing backends where bool tensors were created with native bool storage; older serialized tensors loaded with stale dtype tags; dtype-tag corruption after manual TensorData construction.","solutions":["Ensure bool tensors are created with BoolStore::U8 or BoolStore::U32 storage for this backend","Re-create the bool tensor from u8/u32 data via the backend's from_data path","Cast/reconvert the tensor through an int intermediate (bool_cast) before negating","Report the misleading message text upstream; upgrade burn in case a fix landed"],"exampleFix":"// before\nlet mask = load_bool_tensor(native_bool_data); // Bool(Native)\nlet neg = mask.logical_not(); // panic\n// after\nlet mask_u8 = load_bool_tensor(u8_backed_data); // Bool(U8)\nlet neg = mask_u8.logical_not();","handlingStrategy":"type-guard","validationCode":"fn bool_not_supported(t: &BoolTensor<B>) -> bool {\n    !matches!(t.dtype, DType::Bool(BoolStore::U8) | DType::Bool(BoolStore::U32))\n}","typeGuard":"fn is_backend_bool(dtype: DType) -> bool {\n    matches!(dtype, DType::Bool(BoolStore::U8 | BoolStore::U32))\n}","tryCatchPattern":"// Guard before logical_not:\nif is_backend_bool(mask.dtype) { mask.logical_not() } else { mask.bool_cast::<u8>().logical_not() }","preventionTips":["Create bool tensors via the backend's own from_data so storage matches","Re-create tensors loaded with native bool storage","Audit dtype tags when mixing backends"],"tags":["bool","dtype","logical-not","unimplemented"],"backgroundTag":"unsupported-dtype-conversion","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"}