Repository: incubator-singa Updated Branches: refs/heads/master 3f80cca6e -> 903b8d88e
SINGA-87 Replace exclude field to inlcude field for layer configuration (still support exclude field). Add include field definition in LayerProto. Project: http://git-wip-us.apache.org/repos/asf/incubator-singa/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-singa/commit/059ae9a7 Tree: http://git-wip-us.apache.org/repos/asf/incubator-singa/tree/059ae9a7 Diff: http://git-wip-us.apache.org/repos/asf/incubator-singa/diff/059ae9a7 Branch: refs/heads/master Commit: 059ae9a72a9591b34abce33f14754ae8e8357d6c Parents: 3f80cca Author: jixin <[email protected]> Authored: Fri Nov 6 15:15:47 2015 +0800 Committer: jixin <[email protected]> Committed: Fri Nov 6 16:03:48 2015 +0800 ---------------------------------------------------------------------- examples/cifar10/job.conf | 21 +++++++++++++++++++-- examples/mnist/conv.conf | 4 ++-- examples/mnist/job.conf | 4 ++-- examples/mnist/rbm_job.conf | 4 ++-- examples/rbm/autoencoder.conf | 4 ++-- examples/rbm/rbm1.conf | 4 ++-- examples/rbm/rbm2.conf | 4 ++-- examples/rbm/rbm3.conf | 4 ++-- examples/rbm/rbm4.conf | 4 ++-- examples/rnnlm/job.conf | 4 ++-- src/neuralnet/neuralnet.cc | 10 ++++++++++ src/proto/job.proto | 1 + 12 files changed, 48 insertions(+), 20 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/059ae9a7/examples/cifar10/job.conf ---------------------------------------------------------------------- diff --git a/examples/cifar10/job.conf b/examples/cifar10/job.conf index d69238e..a7540a2 100644 --- a/examples/cifar10/job.conf +++ b/examples/cifar10/job.conf @@ -2,6 +2,8 @@ name: "cifar10-convnet" train_steps: 1000 test_steps: 100 test_freq: 300 +#validate_steps: 100 +#validate_freq: 300 disp_freq: 30 #checkpoint_path: "examples/cifar10/checkpoint/step1000-worker0" train_one_batch { @@ -37,8 +39,23 @@ neuralnet { shape: 32 shape: 32 } - exclude: kTest + include: kTrain } +# layer{ +# name: "data" +# type: kRecordInput +# store_conf { +# backend: "kvfile" +# path: "examples/cifar10/val_data.bin" +# mean_file: "examples/cifar10/image_mean.bin" +# batchsize: 64 +# random_skip: 5000 +# shape: 3 +# shape: 32 +# shape: 32 +# } +# include: kVal +# } layer{ name: "data" type: kRecordInput @@ -51,7 +68,7 @@ neuralnet { shape: 32 shape: 32 } - exclude: kTrain + include: kTest } layer { http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/059ae9a7/examples/mnist/conv.conf ---------------------------------------------------------------------- diff --git a/examples/mnist/conv.conf b/examples/mnist/conv.conf index f655cc9..7818af1 100644 --- a/examples/mnist/conv.conf +++ b/examples/mnist/conv.conf @@ -33,7 +33,7 @@ neuralnet { shape: 28 shape: 28 } - exclude: kTest + include: kTrain } layer { @@ -48,7 +48,7 @@ neuralnet { shape: 28 shape: 28 } - exclude: kTrain + include: kTest } layer { http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/059ae9a7/examples/mnist/job.conf ---------------------------------------------------------------------- diff --git a/examples/mnist/job.conf b/examples/mnist/job.conf index 63f59d2..41d6b6f 100644 --- a/examples/mnist/job.conf +++ b/examples/mnist/job.conf @@ -31,7 +31,7 @@ neuralnet { std_value: 127.5 mean_value: 127.5 } - exclude: kTest + include: kTrain } layer { @@ -45,7 +45,7 @@ neuralnet { std_value: 127.5 mean_value: 127.5 } - exclude: kTrain + include: kTest } layer{ http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/059ae9a7/examples/mnist/rbm_job.conf ---------------------------------------------------------------------- diff --git a/examples/mnist/rbm_job.conf b/examples/mnist/rbm_job.conf index 87df1b3..59a58dd 100644 --- a/examples/mnist/rbm_job.conf +++ b/examples/mnist/rbm_job.conf @@ -28,7 +28,7 @@ model { path: "examples/mnist/mnist_train_shard" batchsize: 20 } - exclude: kTest + include: kTrain } @@ -39,7 +39,7 @@ model { path: "examples/mnist/mnist_test_shard" batchsize: 20 } - exclude: kTrain + include: kTest } http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/059ae9a7/examples/rbm/autoencoder.conf ---------------------------------------------------------------------- diff --git a/examples/rbm/autoencoder.conf b/examples/rbm/autoencoder.conf index 87f10f0..b4dfc64 100644 --- a/examples/rbm/autoencoder.conf +++ b/examples/rbm/autoencoder.conf @@ -29,7 +29,7 @@ neuralnet { std_value: 255 shape: 784 } - exclude: kTest + include: kTrain } layer { @@ -42,7 +42,7 @@ neuralnet { batchsize: 100 shape: 784 } - exclude: kTrain + include: kTest } http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/059ae9a7/examples/rbm/rbm1.conf ---------------------------------------------------------------------- diff --git a/examples/rbm/rbm1.conf b/examples/rbm/rbm1.conf index ef7b875..696a8cb 100644 --- a/examples/rbm/rbm1.conf +++ b/examples/rbm/rbm1.conf @@ -27,7 +27,7 @@ neuralnet { std_value: 255 shape: 784 } - exclude: kTest + include: kTrain } layer { @@ -40,7 +40,7 @@ neuralnet { batchsize: 100 shape: 784 } - exclude: kTrain + include: kTest } layer{ http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/059ae9a7/examples/rbm/rbm2.conf ---------------------------------------------------------------------- diff --git a/examples/rbm/rbm2.conf b/examples/rbm/rbm2.conf index c5e9f2e..ddb9681 100644 --- a/examples/rbm/rbm2.conf +++ b/examples/rbm/rbm2.conf @@ -28,7 +28,7 @@ neuralnet { std_value: 255 shape: 784 } - exclude: kTest + include: kTrain } layer { @@ -41,7 +41,7 @@ neuralnet { batchsize: 100 shape: 784 } - exclude: kTrain + include: kTest } layer{ http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/059ae9a7/examples/rbm/rbm3.conf ---------------------------------------------------------------------- diff --git a/examples/rbm/rbm3.conf b/examples/rbm/rbm3.conf index 798cf02..245cafc 100644 --- a/examples/rbm/rbm3.conf +++ b/examples/rbm/rbm3.conf @@ -30,7 +30,7 @@ neuralnet { std_value: 255 shape: 784 } - exclude: kTest + include: kTrain } layer { @@ -43,7 +43,7 @@ neuralnet { batchsize: 100 shape: 784 } - exclude: kTrain + include: kTest } http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/059ae9a7/examples/rbm/rbm4.conf ---------------------------------------------------------------------- diff --git a/examples/rbm/rbm4.conf b/examples/rbm/rbm4.conf index ae64648..cd4d40a 100644 --- a/examples/rbm/rbm4.conf +++ b/examples/rbm/rbm4.conf @@ -28,7 +28,7 @@ neuralnet { std_value: 255 shape: 784 } - exclude: kTest + include: kTrain } layer { @@ -41,7 +41,7 @@ neuralnet { batchsize: 100 shape: 784 } - exclude: kTrain + include: kTest } http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/059ae9a7/examples/rnnlm/job.conf ---------------------------------------------------------------------- diff --git a/examples/rnnlm/job.conf b/examples/rnnlm/job.conf index a1f803d..aca1166 100644 --- a/examples/rnnlm/job.conf +++ b/examples/rnnlm/job.conf @@ -37,7 +37,7 @@ layer { path: "examples/rnnlm/train_data.bin" max_window: 10 } - exclude: kVal + include: kTrain } layer { @@ -47,7 +47,7 @@ layer { path: "examples/rnnlm/valid_data.bin" max_window: 10 } - exclude: kTrain + include: kVal } layer{ http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/059ae9a7/src/neuralnet/neuralnet.cc ---------------------------------------------------------------------- diff --git a/src/neuralnet/neuralnet.cc b/src/neuralnet/neuralnet.cc index dc85674..ef83dee 100644 --- a/src/neuralnet/neuralnet.cc +++ b/src/neuralnet/neuralnet.cc @@ -46,6 +46,16 @@ NeuralNet* NeuralNet::Create(const NetProto& net_conf, Phase phase, if (p == phase) include = false; } + // if layer.include contains multiple phases, + // check whether the current phase is include + for (auto p : layer.include()){ + if (p == phase){ + include = true; + break; + } + else + include = false; + } if (include == false) continue; LayerProto* layer_conf = conf.add_layer(); layer_conf->CopyFrom(layer); http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/059ae9a7/src/proto/job.proto ---------------------------------------------------------------------- diff --git a/src/proto/job.proto b/src/proto/job.proto index eb1b876..2fbae13 100644 --- a/src/proto/job.proto +++ b/src/proto/job.proto @@ -178,6 +178,7 @@ message LayerProto { // some layers like data layer for loading test data are not used by training // phase should be removed by setting the exclude field. repeated Phase exclude = 15; + repeated Phase include = 14; // type of built-in layer optional LayerType type = 20 [default = kUserLayer]; // type of user layer
