Skip to content
This repository was archived by the owner on Nov 17, 2023. It is now read-only.

Commit 0675c99

Browse files
committed
Updated the MLP test to accept the number of epochs. Reduced the epochs in ci_test.sh to shorten the CI build time
1 parent 7ff6ad1 commit 0675c99

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

cpp-package/example/mlp.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ void OutputAccuracy(mx_float* pred, mx_float* target) {
4949
std::cout << "Accuracy: " << right / 128.0 << std::endl;
5050
}
5151

52-
void MLP() {
52+
void MLP(int max_epoch) {
5353
auto sym_x = Symbol::Variable("X");
5454
auto sym_label = Symbol::Variable("label");
5555

@@ -144,7 +144,6 @@ void MLP() {
144144
grad_req_type, aux_states);
145145

146146
std::cout << "Training" << std::endl;
147-
int max_epoch = 15000;
148147
mx_float learning_rate = 0.0001;
149148
for (int epoch_num = 0; epoch_num < max_epoch; ++epoch_num) {
150149
exe->Forward(true);
@@ -173,8 +172,8 @@ void MLP() {
173172
}
174173

175174
int main(int argc, char** argv) {
176-
MLP();
175+
int max_epoch = argc > 1 ? strtol(argv[1], NULL, 10) : 15000;
176+
MLP(max_epoch);
177177
MXNotifyShutdown();
178178
return 0;
179179
}
180-

cpp-package/tests/ci_test.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,22 @@ ls -l ../../lib/
2525
./get_data.sh
2626

2727
cp ../../build/cpp-package/example/lenet .
28-
./lenet 10
28+
./lenet 1
2929

3030
cp ../../build/cpp-package/example/alexnet .
3131
./alexnet 1
3232

3333
cp ../../build/cpp-package/example/lenet_with_mxdataiter .
34-
./lenet_with_mxdataiter 5
34+
./lenet_with_mxdataiter 1
3535

3636
cp ../../build/cpp-package/example/resnet .
37-
./resnet 5
37+
./resnet 1
3838

3939
cp ../../build/cpp-package/example/inception_bn .
40-
./inception_bn 5
40+
./inception_bn 1
4141

4242
cp ../../build/cpp-package/example/mlp .
43-
./mlp
43+
./mlp 150
4444

4545
cp ../../build/cpp-package/example/mlp_cpu .
4646
./mlp_cpu

0 commit comments

Comments
 (0)