-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
46 lines (37 loc) · 1.07 KB
/
main.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
#include <string>
#include <array>
#include "ap_fixed.h"
#include "emulator.h"
int main()
{
std::string modelName = "L1METML_v1";
hls4mlEmulator::ModelLoader loader = hls4mlEmulator::ModelLoader(modelName);
std::shared_ptr<hls4mlEmulator::Model> model = loader.load_model();
std::cout << "modelInput = [";
ap_fixed<32,16> modelInput[800];
for (int i = 0; i < 800; i++) {
modelInput[i] = 1;
std::cout << modelInput[i] << ", ";
}
std::cout << "]" << std::endl;
ap_fixed<32,16> modelResult[2];
for (int i = 0; i < 2; i++) {
modelResult[i] = -1;
}
model->prepare_input(modelInput);
model->predict();
std::cout << "modelResult before read = [";
for (int i = 0; i < 2; i++){
std::cout << modelResult[i] << ", ";
}
std::cout << "]" << std::endl;
std::cout << "reading result..." << std::endl;
model->read_result(modelResult);
std::cout << "DONE..." << std::endl;
std::cout << "modelResult after read = [";
for (int i = 0; i < 2; i++){
std::cout << modelResult[i] << ", ";
}
std::cout << "]" << std::endl;
return 0;
}