Skip to content

Commit

Permalink
update the the model path to reflect onnx model zoo changes, modes mo…
Browse files Browse the repository at this point in the history
…ved to archive folder
  • Loading branch information
HectorSVC committed Dec 12, 2023
1 parent f74568a commit cf76fb5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 15 deletions.
22 changes: 8 additions & 14 deletions c_cxx/QNN_EP/mobilenetv2_classification/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,10 @@ void run_ort_qnn_ep(const std::string& backend, const std::string& model_path, c
input_node_names[i] = input_name;

// Get input node types
OrtTypeInfo* typeinfo;
CheckStatus(g_ort, g_ort->SessionGetInputTypeInfo(session, i, &typeinfo));
OrtTypeInfo* type_info;
CheckStatus(g_ort, g_ort->SessionGetInputTypeInfo(session, i, &type_info));
const OrtTensorTypeAndShapeInfo* tensor_info;
CheckStatus(g_ort, g_ort->CastTypeInfoToTensorInfo(typeinfo, &tensor_info));
CheckStatus(g_ort, g_ort->CastTypeInfoToTensorInfo(type_info, &tensor_info));
ONNXTensorElementDataType type;
CheckStatus(g_ort, g_ort->GetTensorElementType(tensor_info, &type));
input_types[i] = type;
Expand All @@ -137,10 +137,7 @@ void run_ort_qnn_ep(const std::string& backend, const std::string& model_path, c
input_node_dims[i].resize(num_dims);
CheckStatus(g_ort, g_ort->GetDimensions(tensor_info, input_node_dims[i].data(), num_dims));

size_t tensor_size;
CheckStatus(g_ort, g_ort->GetTensorShapeElementCount(tensor_info, &tensor_size));

if (typeinfo) g_ort->ReleaseTypeInfo(typeinfo);
if (type_info) g_ort->ReleaseTypeInfo(type_info);
}

size_t num_output_nodes;
Expand All @@ -158,21 +155,18 @@ void run_ort_qnn_ep(const std::string& backend, const std::string& model_path, c
CheckStatus(g_ort, g_ort->SessionGetOutputName(session, i, allocator, &output_name));
output_node_names[i] = output_name;

OrtTypeInfo* typeinfo;
CheckStatus(g_ort, g_ort->SessionGetOutputTypeInfo(session, i, &typeinfo));
OrtTypeInfo* type_info;
CheckStatus(g_ort, g_ort->SessionGetOutputTypeInfo(session, i, &type_info));
const OrtTensorTypeAndShapeInfo* tensor_info;
CheckStatus(g_ort, g_ort->CastTypeInfoToTensorInfo(typeinfo, &tensor_info));
CheckStatus(g_ort, g_ort->CastTypeInfoToTensorInfo(type_info, &tensor_info));

// Get output shapes/dims
size_t num_dims;
CheckStatus(g_ort, g_ort->GetDimensionsCount(tensor_info, &num_dims));
output_node_dims[i].resize(num_dims);
CheckStatus(g_ort, g_ort->GetDimensions(tensor_info, (int64_t*)output_node_dims[i].data(), num_dims));

size_t tensor_size;
CheckStatus(g_ort, g_ort->GetTensorShapeElementCount(tensor_info, &tensor_size));

if (typeinfo) g_ort->ReleaseTypeInfo(typeinfo);
if (type_info) g_ort->ReleaseTypeInfo(type_info);
}

OrtMemoryInfo* memory_info;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@ECHO OFF

set ONNX_MODEL_URL="https://github.com/onnx/models/raw/main/vision/classification/mobilenet/model/mobilenetv2-12.onnx"
set ONNX_MODEL_URL="https://github.com/onnx/models/raw/main/archive/vision/classification/mobilenet/model/mobilenetv2-12.onnx"
set ONNX_MODEL="mobilenetv2-12.onnx"
set KITTEN_IMAGE_URL="https://s3.amazonaws.com/model-server/inputs/kitten.jpg"
set KITTEN_IMAGE="images/kitten.jpg"
Expand Down

0 comments on commit cf76fb5

Please sign in to comment.