-
Notifications
You must be signed in to change notification settings - Fork 0
/
m2.cc
33 lines (24 loc) · 746 Bytes
/
m2.cc
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
#include "ece408net.h"
void inference_only(int batch_size) {
std::cout<<"Loading fashion-mnist data...";
MNIST dataset("../data/fmnist-86/");
dataset.read_test_data(batch_size);
std::cout<<"Done"<<std::endl;
std::cout<<"Loading model...";
Network dnn = createNetwork_GPU();
std::cout<<"Done"<<std::endl;
dnn.forward(dataset.test_data);
float acc = compute_accuracy(dnn.output(), dataset.test_labels);
std::cout<<std::endl;
std::cout<<"Test Accuracy: "<<acc<< std::endl;
std::cout<<std::endl;
}
int main(int argc, char* argv[]) {
int batch_size = 10000;
if(argc == 2){
batch_size = atoi(argv[1]);
}
std::cout<<"Test batch size: "<<batch_size<<std::endl;
inference_only(batch_size);
return 0;
}