forked from openvinotoolkit/openvino
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_model_repo.hpp
54 lines (41 loc) · 1.25 KB
/
test_model_repo.hpp
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
// Copyright (C) 2018-2024 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#pragma once
#include <fstream>
#include <random>
#include "openvino/core/visibility.hpp"
#include "openvino/pass/manager.hpp"
#include "openvino/util/file_util.hpp"
namespace TestDataHelpers {
extern const std::string model_bin_name;
extern const std::string model_xml_name;
extern const std::string model_exported_name;
void generate_test_model();
inline std::string get_model_xml_file_name() {
return model_xml_name;
}
inline std::string get_model_bin_file_name() {
return model_bin_name;
}
inline std::string get_exported_blob_file_name() {
return model_exported_name;
}
inline void release_test_model() {
std::remove(model_xml_name.c_str());
std::remove(model_bin_name.c_str());
}
inline void fill_random_input_nv12_data(uint8_t* data, const size_t w, const size_t h) {
size_t size = w * h * 3 / 2;
std::mt19937 gen(0);
std::uniform_int_distribution<> distribution(0, 255);
for (size_t i = 0; i < size; i++) {
data[i] = static_cast<uint8_t>(distribution(gen));
}
return;
}
std::string generate_test_xml_file();
inline void delete_test_xml_file() {
std::remove("plugin_test.xml");
}
} // namespace TestDataHelpers