Skip to content

Commit

Permalink
Updated the MLP test to accept the number of epochs. Reduced the epoc…
Browse files Browse the repository at this point in the history
…hs in ci_test.sh to shorten the CI build time (apache#14149)
  • Loading branch information
leleamol authored and haohuw committed Jun 23, 2019
1 parent 646f4d5 commit 788f821
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
7 changes: 3 additions & 4 deletions cpp-package/example/mlp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}

10 changes: 5 additions & 5 deletions cpp-package/tests/ci_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 788f821

Please sign in to comment.