You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by ns...@apache.org on 2018/11/27 18:32:30 UTC

[incubator-mxnet] branch master updated: [Example]Fix mlp_csv example (#13273)

This is an automated email from the ASF dual-hosted git repository.

nswamy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git


The following commit(s) were added to refs/heads/master by this push:
     new 4f8aa09  [Example]Fix mlp_csv example (#13273)
4f8aa09 is described below

commit 4f8aa092a6fdaa98fe6f1afac24eabb2c98f5e2a
Author: Jake Lee <gs...@gmail.com>
AuthorDate: Tue Nov 27 10:32:17 2018 -0800

    [Example]Fix mlp_csv example (#13273)
    
    * add instruction to get the data and fix typo
    
    * fix typo
    
    * update file name
    
    * trigger CI
    
    * add unit_test for unit_test_mlp_csv
    
    * add mlp_csv to jenkinsfile
    
    * revert jenkinsfile to another PR
    
    * trigger CI
    
    * trigger CI
---
 cpp-package/example/README.md   | 8 +++++++-
 cpp-package/example/mlp_csv.cpp | 2 +-
 cpp-package/tests/ci_test.sh    | 2 ++
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/cpp-package/example/README.md b/cpp-package/example/README.md
index 06ea17b..c7223e9 100644
--- a/cpp-package/example/README.md
+++ b/cpp-package/example/README.md
@@ -69,7 +69,13 @@ build/mlp_gpu
 The code implements a multilayer perceptron to train the MNIST data. The code demonstrates the use of the "SimpleBind"  C++ API and CSVIter. The CSVIter can iterate data that is in CSV format. The example can be run on CPU or GPU. The example usage is as follows:
 
 ```
-build/mlp_csv --train mnist_training_set.csv --test mnist_test_set.csv --epochs 10 --batch_size 100 --hidden_units "128,64,64 [--gpu]"
+build/mlp_csv --train data/mnist_data/mnist_train.csv --test data/mnist_data/mnist_test.csv --epochs 10 --batch_size 100 --hidden_units "128 64 64" --gpu
+```
+* To get the `mnist_training_set.csv` and `mnist_test_set.csv` please run the following command:
+```python
+# in incubator-mxnet/cpp-package/example directory
+python mnist_to_csv.py ./data/mnist_data/train-images-idx3-ubyte ./data/mnist_data/train-labels-idx1-ubyte ./data/mnist_data/mnist_train.csv 60000
+python mnist_to_csv.py ./data/mnist_data/t10k-images-idx3-ubyte ./data/mnist_data/t10k-labels-idx1-ubyte ./data/mnist_data/mnist_test.csv 10000
 ```
 
 ### [resnet.cpp](<https://github.com/apache/incubator-mxnet/blob/master/cpp-package/example/resnet.cpp>)
diff --git a/cpp-package/example/mlp_csv.cpp b/cpp-package/example/mlp_csv.cpp
index 8aec4b7..43a14c8 100644
--- a/cpp-package/example/mlp_csv.cpp
+++ b/cpp-package/example/mlp_csv.cpp
@@ -72,7 +72,7 @@ std::vector<int> getLayers(const std::string& hidden_units_string) {
 void printUsage() {
     std::cout << "Usage:" << std::endl;
     std::cout << "mlp_csv --train mnist_training_set.csv --test mnist_test_set.csv --epochs 10 "
-    << "--batch_size 100 --hidden_units \"128 64 64\" [--gpu]" << std::endl;
+    << "--batch_size 100 --hidden_units \"128 64 64\" --gpu" << std::endl;
     std::cout << "The example uses mnist data in CSV format. The MNIST data in CSV format assumes "
     << "the column 0 to be label and the rest 784 column to be data." << std::endl;
     std::cout << "By default, the example uses 'cpu' context. If '--gpu' is specified, "
diff --git a/cpp-package/tests/ci_test.sh b/cpp-package/tests/ci_test.sh
index 57007f3..7674e2d 100755
--- a/cpp-package/tests/ci_test.sh
+++ b/cpp-package/tests/ci_test.sh
@@ -50,3 +50,5 @@ cp ../../build/cpp-package/example/mlp_gpu .
 
 cp ../../build/cpp-package/example/test_score .
 ./test_score 0.93
+
+sh unittests/unit_test_mlp_csv.sh