From 6ef55feec2cb9e641e6414e7f99de7e130d8b13f Mon Sep 17 00:00:00 2001 From: Lai Wei Date: Tue, 4 Dec 2018 09:58:37 -0800 Subject: [PATCH 1/4] add inception test --- cpp-package/tests/ci_test.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cpp-package/tests/ci_test.sh b/cpp-package/tests/ci_test.sh index 7674e2d988b2..4a17d8d34c19 100755 --- a/cpp-package/tests/ci_test.sh +++ b/cpp-package/tests/ci_test.sh @@ -36,6 +36,9 @@ cp ../../build/cpp-package/example/lenet_with_mxdataiter . cp ../../build/cpp-package/example/resnet . ./resnet 5 +cp ../../build/cpp-package/example/inception_bn . +./inception_bn 5 + cp ../../build/cpp-package/example/mlp . ./mlp From 58cd0d835766d0d6c1a5ba10c9788f9a87229008 Mon Sep 17 00:00:00 2001 From: Lai Wei Date: Tue, 4 Dec 2018 13:37:20 -0800 Subject: [PATCH 2/4] fix max iter for mlp --- cpp-package/example/mlp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp-package/example/mlp.cpp b/cpp-package/example/mlp.cpp index 595d75c67c06..571e26964081 100644 --- a/cpp-package/example/mlp.cpp +++ b/cpp-package/example/mlp.cpp @@ -144,7 +144,7 @@ void MLP() { grad_req_type, aux_states); std::cout << "Training" << std::endl; - int max_iters = 20000; + int max_iters = 10; mx_float learning_rate = 0.0001; for (int iter = 0; iter < max_iters; ++iter) { exe->Forward(true); From 77ce1f3c0e8812275b142001ff02a975b6caf170 Mon Sep 17 00:00:00 2001 From: Lai Wei Date: Wed, 5 Dec 2018 16:14:49 -0800 Subject: [PATCH 3/4] rename and add comment --- cpp-package/example/mlp.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cpp-package/example/mlp.cpp b/cpp-package/example/mlp.cpp index 571e26964081..9a7cf80e0db4 100644 --- a/cpp-package/example/mlp.cpp +++ b/cpp-package/example/mlp.cpp @@ -144,11 +144,11 @@ void MLP() { grad_req_type, aux_states); std::cout << "Training" << std::endl; - int max_iters = 10; + int max_epoch = 20000; mx_float learning_rate = 0.0001; - for (int iter = 0; iter < max_iters; ++iter) { + for (int iter = 0; iter < max_epoch; ++iter) { exe->Forward(true); - + // print accuracy every 100 epoch if (iter % 100 == 0) { std::cout << "epoch " << iter << std::endl; std::vector& out = exe->outputs; From 975001a149036550451b77ba75c2ea5bb3349d99 Mon Sep 17 00:00:00 2001 From: Lai Wei Date: Wed, 5 Dec 2018 16:21:47 -0800 Subject: [PATCH 4/4] rename epoch num --- cpp-package/example/mlp.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cpp-package/example/mlp.cpp b/cpp-package/example/mlp.cpp index 9a7cf80e0db4..cc16f53cf205 100644 --- a/cpp-package/example/mlp.cpp +++ b/cpp-package/example/mlp.cpp @@ -144,13 +144,13 @@ void MLP() { grad_req_type, aux_states); std::cout << "Training" << std::endl; - int max_epoch = 20000; + int max_epoch = 15000; mx_float learning_rate = 0.0001; - for (int iter = 0; iter < max_epoch; ++iter) { + for (int epoch_num = 0; epoch_num < max_epoch; ++epoch_num) { exe->Forward(true); // print accuracy every 100 epoch - if (iter % 100 == 0) { - std::cout << "epoch " << iter << std::endl; + if (epoch_num % 100 == 0) { + std::cout << "epoch " << epoch_num << std::endl; std::vector& out = exe->outputs; float* cptr = new float[128 * 10]; out[0].SyncCopyToCPU(cptr, 128 * 10);