fix: allow using tensors with undefined element types

This commit is contained in:
Carson M.
2026-03-11 14:32:30 -05:00
parent aaec1a437e
commit 82e6d652e1

View File

@@ -389,7 +389,6 @@ impl Drop for Outlet {
pub(crate) unsafe fn extract_data_type_from_tensor_info(info_ptr: NonNull<ort_sys::OrtTensorTypeAndShapeInfo>) -> ValueType {
let mut type_sys = ort_sys::ONNXTensorElementDataType::ONNX_TENSOR_ELEMENT_DATA_TYPE_UNDEFINED;
ortsys![unsafe GetTensorElementType(info_ptr.as_ptr(), &mut type_sys).expect("infallible")];
assert_ne!(type_sys, ort_sys::ONNXTensorElementDataType::ONNX_TENSOR_ELEMENT_DATA_TYPE_UNDEFINED);
// This transmute should be safe since its value is read from GetTensorElementType, which we must trust
let mut num_dims = 0;
ortsys![unsafe GetDimensionsCount(info_ptr.as_ptr(), &mut num_dims).expect("infallible")];