forked from openvinotoolkit/openvino
-
Notifications
You must be signed in to change notification settings - Fork 1
/
test_model_repo.cpp
55 lines (46 loc) · 1.93 KB
/
test_model_repo.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Copyright (C) 2018-2024 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "test_model_repo.hpp"
#include "common_test_utils/file_utils.hpp"
#include "common_test_utils/subgraph_builders/conv_pool_relu_no_reshapes.hpp"
#include "openvino/pass/serialize.hpp"
namespace TestDataHelpers {
const std::string model_bin_name = "test_model.bin";
const std::string model_xml_name = "test_model.xml";
const std::string model_exported_name = "test_exported_model.blob";
void generate_test_model() {
ov::pass::Manager manager;
manager.register_pass<ov::pass::Serialize>(model_xml_name, model_bin_name);
auto function = ov::test::utils::make_conv_pool_relu_no_reshapes({1, 3, 227, 227});
manager.run_passes(function);
}
std::string generate_test_xml_file() {
// Create the file
std::string plugin_xml = "plugin_test.xml";
std::ofstream plugin_xml_file(plugin_xml);
// Write to the file
plugin_xml_file << "<!--\n";
plugin_xml_file << "Copyright (C) 2023 Intel Corporation\n";
plugin_xml_file << "SPDX-License-Identifier: Apache-2.0\n";
plugin_xml_file << "-->\n";
plugin_xml_file << "\n";
plugin_xml_file << "<ie>\n";
plugin_xml_file << " <plugins>\n";
plugin_xml_file << " <plugin location=\"";
plugin_xml_file << ov::test::utils::getExecutableDirectory();
plugin_xml_file << ov::util::FileTraits<char>::file_separator;
plugin_xml_file << ov::util::FileTraits<char>::library_prefix();
plugin_xml_file << "mock_engine";
plugin_xml_file << OV_BUILD_POSTFIX;
plugin_xml_file << ov::util::FileTraits<char>::dot_symbol;
plugin_xml_file << ov::util::FileTraits<char>::library_ext();
plugin_xml_file << "\" name=\"CUSTOM\">\n";
plugin_xml_file << " </plugin>\n";
plugin_xml_file << " </plugins>\n";
plugin_xml_file << "</ie>\n";
// Close the file
plugin_xml_file.close();
return plugin_xml;
}
} // namespace TestDataHelpers