mirror of
https://github.com/pykeio/ort
synced 2026-04-25 16:34:55 +02:00
fix: allow using tensors with undefined element types
This commit is contained in:
@@ -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")];
|
||||
|
||||
Reference in New Issue
Block a user