Skip to content

Commit 1cb53d0

Browse files
[QNN-EP] Fix ONNX context model helper. (microsoft#24271)
### Description <!-- Describe your changes. --> Fix the bug where the QNN EP generates an ONNX model with EP Context and fails to run. ### Motivation and Context <!-- - Why is this change required? What problem does it solve? - If it fixes an open issue, please link to the issue here. --> When generating an ONNX model with QNN EP context where the input is scalar, the shape is not set, resulting in a null pointer and causing the subsequent run to fail.
1 parent 82c8e56 commit 1cb53d0

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

onnxruntime/core/providers/qnn/builder/onnx_ctx_model_helper.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ Status CreateNodeArgs(const std::vector<std::string>& names,
7777
const OnnxTensorInfo& tensor_info = tensor_info_table.at(name);
7878
std::unique_ptr<ONNX_NAMESPACE::TypeProto> tensor_type = Factory<ONNX_NAMESPACE::TypeProto>::Create();
7979
tensor_type->mutable_tensor_type()->set_elem_type(tensor_info.data_type_);
80+
tensor_type->mutable_tensor_type()->mutable_shape();
8081
for (size_t j = 0; j < tensor_info.shape_.size(); ++j) {
8182
tensor_type->mutable_tensor_type()->mutable_shape()->add_dim()->set_dim_value(tensor_info.shape_[j]);
8283
}

0 commit comments

Comments
 (0)