mirror of
https://github.com/pykeio/ort
synced 2026-04-25 16:34:55 +02:00
fix: string attributes in ShapeInferenceContext
This commit is contained in:
@@ -197,9 +197,9 @@ impl FromOpAttr for String {
|
||||
where
|
||||
Self: Sized
|
||||
{
|
||||
let mut out = vec![0_u8; len];
|
||||
ortsys![unsafe ReadOpAttr(attr, ort_sys::OrtOpAttrType::ORT_OP_ATTR_STRING, out.as_mut_ptr().cast(), len, &mut len)?];
|
||||
debug_assert_eq!(out.len(), len, "int attribute is smaller/larger than expected");
|
||||
let mut out = vec![0_u8; len + 1];
|
||||
ortsys![unsafe ReadOpAttr(attr, ort_sys::OrtOpAttrType::ORT_OP_ATTR_STRING, out.as_mut_ptr().cast(), len + 1, &mut len)?];
|
||||
debug_assert_eq!(out.len(), len + 1, "string attribute is smaller/larger than expected");
|
||||
CString::from_vec_with_nul(out)
|
||||
.map_err(|_| Error::new("invalid string attribute contents"))
|
||||
.and_then(|f| f.into_string().map_err(|_| Error::new("invalid string attribute contents")))
|
||||
|
||||
Reference in New Issue
Block a user