summaryrefslogtreecommitdiff
path: root/runtimes/tests/bring_up_test/simple_model_main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'runtimes/tests/bring_up_test/simple_model_main.cpp')
-rw-r--r--runtimes/tests/bring_up_test/simple_model_main.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/runtimes/tests/bring_up_test/simple_model_main.cpp b/runtimes/tests/bring_up_test/simple_model_main.cpp
new file mode 100644
index 000000000..edb6f0fe7
--- /dev/null
+++ b/runtimes/tests/bring_up_test/simple_model_main.cpp
@@ -0,0 +1,35 @@
+#include <string>
+#include <fcntl.h>
+#include <sys/mman.h>
+#include <unistd.h>
+#include <iostream>
+
+#include "simple_model.h"
+
+int main()
+{
+ // This is a simple test for bring-up stage
+ // TODO Remove this file when we have unit tests ready.
+
+ const char *fname = "model_data.bin";
+ float input1 = 1.0f;
+ float input2 = 2.0f;
+ int fd = open(fname, O_RDONLY);
+ off_t offset = 0;
+ off_t length = lseek(fd, 0, SEEK_END);
+
+ SimpleModel* nn_model = new SimpleModel(length, PROT_READ, fd, offset);
+ if (!nn_model->CreateCompiledModel()) {
+ std::cerr << "Failed to prepare the model." << std::endl;
+ return 1;
+ }
+
+ float result = 0.0f;
+ nn_model->Compute(input1, input2, &result);
+
+ std::cout << "result : " << result << std::endl;
+
+ delete(nn_model);
+
+ return 0;
+}