{"record":{"id":"ac2006fb5b710f73","repo":"huggingface/candle","slug":"unsupported-value-data-type-dt-for","errorCode":null,"errorMessage":"unsupported 'value' data-type {dt:?} for {}","messagePattern":"unsupported 'value' data-type (.+?) for (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"candle-onnx/src/eval.rs","lineNumber":280,"sourceCode":"        };\n        let input_type = match &input_type.value {\n            Some(input_type) => input_type,\n            None => continue,\n        };\n        let tensor_type = match input_type {\n            onnx::type_proto::Value::TensorType(tt) => tt,\n            _ => continue,\n        };\n\n        let tensor = match values.get(&input.name) {\n            None => bail!(\"missing input {}\", input.name),\n            Some(tensor) => tensor,\n        };\n        let dt = match DataType::try_from(tensor_type.elem_type) {\n            Ok(dt) => match dtype(dt) {\n                Some(dt) => dt,\n                None => {\n                    bail!(\"unsupported 'value' data-type {dt:?} for {}\", input.name)\n                }\n            },\n            type_ => bail!(\"unsupported input type {type_:?}\"),\n        };\n        match &tensor_type.shape {\n            None => continue,\n            Some(shape) => {\n                if shape.dim.len() != tensor.rank() {\n                    bail!(\n                        \"unexpected rank for {}, got {:?}, expected {:?}\",\n                        input.name,\n                        shape.dim,\n                        tensor.shape()\n                    )\n                }\n                for (idx, (d, &dim)) in shape.dim.iter().zip(tensor.dims().iter()).enumerate() {\n                    match &d.value {\n                        Some(onnx::tensor_shape_proto::dimension::Value::DimValue(v)) => {","sourceCodeStart":262,"sourceCodeEnd":298,"githubUrl":"https://github.com/huggingface/candle/blob/d5fee525bfde3273eb7c9b75fd2bc4937be867ca/candle-onnx/src/eval.rs#L262-L298","documentation":"During input validation in simple_eval_, the declared elem_type maps to a valid ONNX DataType but candle's dtype() returns None — meaning ONNX knows the element type but candle-onnx has no corresponding DType (or it is intentionally unsupported). The library refuses to build an input tensor of that type.","triggerScenarios":"Supplying inputs to simple_eval where a graph input is declared with an element type known to ONNX but unsupported by candle-onnx (e.g. float8, bfloat16 depending on version, string, complex types).","commonSituations":"Feeding bf16 tensors to a candle-onnx build lacking bf16 support; string inputs (tokenizers sometimes declare string inputs); models from exporters using newer type sets.","solutions":["Cast the input tensor to a supported dtype (f32/i64) and re-run eval.","Re-export the model with a supported elem_type for its inputs.","Check the candle-onnx version's supported dtype list; upgrade if a newer version adds the type.","If the input is unused by the graph, remove it from the model's input list during export (non-optional inputs are validated)."],"exampleFix":"// before\nlet v = Tensor::from_vec(bf16_data, shape)?; // bfloat16 input\n// after\nlet v = Tensor::from_vec(bf16_data.to_f32v(), shape)?; // cast to f32","handlingStrategy":"type-guard","validationCode":"fn input_dtypes_supported(model: &onnx::ModelProto) -> bool {\n    model.graph.as_ref().map_or(true, |g| g.input.iter().all(|i| {\n        match &i.r#type.value {\n            Some(onnx::type_proto::Value::TensorType(tt)) =>\n                candle_onnx::DataType::try_from(tt.elem_type)\n                    .ok()\n                    .and_then(candle_onnx::eval::dtype)\n                    .is_some(),\n            _ => true,\n        }\n    }))\n}","typeGuard":"fn has_candle_dtype(elem_type: i32) -> bool {\n    use candle_onnx::DataType;\n    DataType::try_from(elem_type).ok()\n        .and_then(candle_onnx::eval::dtype)\n        .is_some()\n}","tryCatchPattern":"match simple_eval(&model, inputs) {\n    Err(e) if e.to_string().contains(\"unsupported 'value' data-type\") => {\n        anyhow::bail!(\"convert inputs to a supported dtype (f32/i64) before eval\")\n    }\n    r => r?,\n}","preventionTips":["Cast inputs to f32/i64 before eval","Avoid models with bf16/f16/string/graph inputs unless supported","Check supported dtypes for your candle-onnx version","Re-export with standard elem_types"],"tags":["onnx","dtype","unsupported-type","eval"],"backgroundTag":"unsupported-onnx-dtype","analyzedSha":"d5fee525bfde3273eb7c9b75fd2bc4937be867ca","analyzedAt":"2026-09-02T00:15:47.023Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}