forked from uTensor/uTensor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
112 lines (91 loc) · 2.72 KB
/
main.cpp
File metadata and controls
112 lines (91 loc) · 2.72 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#include "FATFileSystem.h"
#include "SDBlockDevice.h"
#include "mbed.h"
#include "stdio.h"
#include "uTensor_util.hpp"
#include "tensor.hpp"
#include "tensorIdxImporterTests.hpp"
#include "context.hpp"
#include "ArrayTests.hpp"
#include "MatrixTests.hpp"
#include "tensor_test.hpp"
#include "NnTests.hpp"
// #include "mlp_test.hpp"
#include "deep_mnist_mlp.hpp"
#include "context_test.hpp"
#include "MathTests.hpp"
#include "sdtest.hpp"
#include "vmtest.hpp"
Serial pc(USBTX, USBRX, 115200);
SDBlockDevice bd(MBED_CONF_APP_SD_MOSI, MBED_CONF_APP_SD_MISO,
MBED_CONF_APP_SD_CLK, MBED_CONF_APP_SD_CS);
FATFileSystem fs("fs");
int main(int argc, char** argv) {
ON_ERR(bd.init(), "SDBlockDevice init ");
ON_ERR(fs.mount(&bd), "Mounting the filesystem on \"/fs\". ");
init_env();
printf("Deep MLP on Mbed (Trained with Tensorflow)\r\n\r\n");
printf("running deep-mlp...\r\n");
int prediction = runMLP("/fs/testData/deep_mlp/import-Placeholder_0.idx");
printf("prediction: %d\r\n\r\n\r\n\r\n", prediction);
printf("IDX import:\r\n");
idxImporterTest idxTest;
idxTest.runAll();
printf("IDX import result...\r\n");
idxTest.printSummary();
printf("vm: \r\n");
vmTest vmtest;
vmtest.runAll();
printf("VM result...\r\n");
vmtest.printSummary();
printf("SDTensor test:\r\n");
SDTensorTest sdtest;
sdtest.runAll();
printf("sd tensor result...\r\n");
sdtest.printSummary();
printf("tesnor test: \r\n");
tensorTest tenT;
tenT.runAll();
printf("tensor result...\r\n");
tenT.printSummary();
printf("Context test: \r\n");
contextTest ctxTest;
ctxTest.runAll();
printf("Context result...\r\n");
ctxTest.printSummary();
printf("Transformation test: \r\n");
transTest tTest;
tTest.runAll();
printf("Transformation result...\r\n");
tTest.printSummary();
printf("Array test: \r\n");
ArrayOpsTest arrayTests;
arrayTests.runAll();
printf("Array result...\r\n");
arrayTests.printSummary();
printf("Math: \r\n");
MathOpsTest mathTests;
mathTests.runAll();
printf("Math result...\r\n");
mathTests.printSummary();
printf("running matrix test:\r\n");
matrixOpsTest matrixTests;
matrixTests.runAll();
printf("running matrix result ...\r\n");
matrixTests.printSummary();
printf("NnOpS: \r\n");
NnOpsTest nnTest;
nnTest.runAll();
printf("Nn Ops result...\r\n");
nnTest.printSummary();
/* printf("mlp test: \r\n");
mlpTest mlpt;
mlpt.runAll();
printf("mlp result...\r\n");
mlpt.printSummary();*/
//In [24]: tf.get_default_graph().get_tensor_by_name("import/y_pred:0").eval(feed_dict={x: mnist.test.images[0:1]})
//Out[24]: array([7])
printf("\r\ndone...\r\n");
ON_ERR(fs.unmount(), "fs unmount ");
ON_ERR(bd.deinit(), "SDBlockDevice de-init ");
}