Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] C++ API SetOutputShape for register custom op. #21366

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions include/onnxruntime/core/session/onnxruntime_cxx_inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -1982,7 +1982,9 @@ inline ShapeInferContext::ShapeInferContext(const OrtApi* ort_api,
TensorTypeAndShapeInfo type_shape_info(info);
auto integer_shape = type_shape_info.GetShape();
std::vector<const char*> symbolic_shape(integer_shape.size(), {});
type_shape_info.GetSymbolicDimensions(&symbolic_shape[0], integer_shape.size());
if (!integer_shape.empty()) {
type_shape_info.GetSymbolicDimensions(&symbolic_shape[0], integer_shape.size());
}
Shape shape;
for (size_t ith = 0; ith < integer_shape.size(); ++ith) {
if (symbolic_shape[ith] && std::string{symbolic_shape[ith]}.size() > 0) {
Expand Down Expand Up @@ -2011,7 +2013,7 @@ inline Status ShapeInferContext::SetOutputShape(size_t indice, const Shape& shap

for (const auto dim : shape) {
if (dim.IsInt()) {
integer_dims.push_back(dim.IsInt());
integer_dims.push_back(dim.AsInt());
symbolic_dims.push_back("");
} else {
if (!dim.AsSym() || std::string{dim.AsSym()}.empty()) {
Expand Down
Loading