Skip to content

Commit

Permalink
[Fix] ShapeInferContext GetAttrxxxs support empty value
Browse files Browse the repository at this point in the history
  • Loading branch information
mingyueliuh committed Jul 24, 2024
1 parent 11bf309 commit f094764
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions include/onnxruntime/core/session/onnxruntime_cxx_inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -2048,6 +2048,9 @@ inline ShapeInferContext::Ints ShapeInferContext::GetAttrInts(const char* attr_n
Ort::ThrowOnError(ort_api_->ReadOpAttr(attr, ORT_OP_ATTR_INTS, ints.data(), out, &out));
return ints;
} else {
if (out == 0u) {
return {};
}
return {i};
}
}
Expand All @@ -2072,6 +2075,9 @@ inline ShapeInferContext::Floats ShapeInferContext::GetAttrFloats(const char* at
Ort::ThrowOnError(ort_api_->ReadOpAttr(attr, ORT_OP_ATTR_FLOATS, floats.data(), out, &out));
return floats;
} else {
if (out == 0u) {
return {};
}
return {f};
}
}
Expand Down Expand Up @@ -2112,6 +2118,9 @@ inline ShapeInferContext::Strings ShapeInferContext::GetAttrStrings(const char*
}
return strings;
} else {
if (out == 0u) {
return {};
}
return {std::string{c}};
}
}
Expand Down

0 comments on commit f094764

Please sign in to comment.