From 87162a62646a5c010976fbda7574a8e0ab321937 Mon Sep 17 00:00:00 2001 From: Amol Lele <19983848+leleamol@users.noreply.github.com> Date: Wed, 13 Feb 2019 15:09:40 -0800 Subject: [PATCH] Updated the MLP test to accept the number of epochs. Reduced the epochs in ci_test.sh to shorten the CI build time --- cpp-package/example/mlp.cpp | 7 +++---- cpp-package/tests/ci_test.sh | 10 +++++----- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/cpp-package/example/mlp.cpp b/cpp-package/example/mlp.cpp index cc16f53cf205..c3760fd3c846 100644 --- a/cpp-package/example/mlp.cpp +++ b/cpp-package/example/mlp.cpp @@ -49,7 +49,7 @@ void OutputAccuracy(mx_float* pred, mx_float* target) { std::cout << "Accuracy: " << right / 128.0 << std::endl; } -void MLP() { +void MLP(int max_epoch) { auto sym_x = Symbol::Variable("X"); auto sym_label = Symbol::Variable("label"); @@ -144,7 +144,6 @@ void MLP() { grad_req_type, aux_states); std::cout << "Training" << std::endl; - int max_epoch = 15000; mx_float learning_rate = 0.0001; for (int epoch_num = 0; epoch_num < max_epoch; ++epoch_num) { exe->Forward(true); @@ -173,8 +172,8 @@ void MLP() { } int main(int argc, char** argv) { - MLP(); + int max_epoch = argc > 1 ? strtol(argv[1], NULL, 10) : 15000; + MLP(max_epoch); MXNotifyShutdown(); return 0; } - diff --git a/cpp-package/tests/ci_test.sh b/cpp-package/tests/ci_test.sh index 7abdef481ec9..18fabea7a7f9 100755 --- a/cpp-package/tests/ci_test.sh +++ b/cpp-package/tests/ci_test.sh @@ -25,22 +25,22 @@ ls -l ../../lib/ ./get_data.sh cp ../../build/cpp-package/example/lenet . -./lenet 10 +./lenet 1 cp ../../build/cpp-package/example/alexnet . ./alexnet 1 cp ../../build/cpp-package/example/lenet_with_mxdataiter . -./lenet_with_mxdataiter 5 +./lenet_with_mxdataiter 1 cp ../../build/cpp-package/example/resnet . -./resnet 5 +./resnet 1 cp ../../build/cpp-package/example/inception_bn . -./inception_bn 5 +./inception_bn 1 cp ../../build/cpp-package/example/mlp . -./mlp +./mlp 150 cp ../../build/cpp-package/example/mlp_cpu . ./mlp_cpu