mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-18 18:52:16 +00:00
Update unit test to check that JSON file was generated
This commit is contained in:
parent
00565edf07
commit
887bad9187
1 changed files with 19 additions and 5 deletions
|
|
@ -1027,6 +1027,7 @@ TEST_F(QnnHTPBackendTests, EPRejectsDynamicShapesF32) {
|
|||
}
|
||||
|
||||
TEST_F(QnnHTPBackendTests, DumpJsonQNNGraph) {
|
||||
const ORTCHAR_T* ort_model_path = ORT_MODEL_FOLDER "nhwc_resize_sizes_opset18.quant.onnx";
|
||||
Ort::SessionOptions so;
|
||||
onnxruntime::ProviderOptions options;
|
||||
#if defined(_WIN32)
|
||||
|
|
@ -1035,16 +1036,29 @@ TEST_F(QnnHTPBackendTests, DumpJsonQNNGraph) {
|
|||
options["backend_path"] = "libQnnHtp.so";
|
||||
#endif
|
||||
|
||||
const std::filesystem::path dump_dir = "test_qnn_graphs_";
|
||||
options["json_qnn_graph_dir"] = dump_dir.string();
|
||||
options["dump_json_qnn_graph"] = "1";
|
||||
|
||||
// Remove pre-existing json files. Note that fs::remove_all() can handle non-existing paths.
|
||||
std::filesystem::remove_all(dump_dir);
|
||||
ASSERT_TRUE(std::filesystem::create_directory(dump_dir));
|
||||
|
||||
so.AppendExecutionProvider("QNN", options);
|
||||
|
||||
Ort::Status status(OrtSessionOptionsAppendExecutionProvider_CPU(so, 1));
|
||||
|
||||
const ORTCHAR_T* ort_model_path = ORT_MODEL_FOLDER "nhwc_resize_sizes_opset18.quant.onnx";
|
||||
|
||||
Ort::Session session(*ort_env, ort_model_path, so);
|
||||
// TODO(adrianlizarraga): Check that output json files were generated.
|
||||
|
||||
// Check that QNN JSON file(s) exist.
|
||||
bool has_a_json_file = false;
|
||||
for (auto const& dir_entry : std::filesystem::directory_iterator{dump_dir}) {
|
||||
EXPECT_TRUE(dir_entry.is_regular_file());
|
||||
EXPECT_EQ(dir_entry.path().extension().string(), ".json");
|
||||
has_a_json_file = true;
|
||||
}
|
||||
EXPECT_TRUE(has_a_json_file);
|
||||
|
||||
// Cleaup generated files. Comment the following line to inspect generated JOSN files.
|
||||
std::filesystem::remove_all(dump_dir);
|
||||
}
|
||||
|
||||
// Test option for offloading quantization of graph inputs and dequantization of graph outputs to the CPU EP.
|
||||
|
|
|
|||
Loading…
Reference in a new issue