You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@singa.apache.org by wa...@apache.org on 2015/08/12 10:28:38 UTC

incubator-singa git commit: SINGA-49 Fix a bug in HandlePutMsg func that sets param fields to invalid values

Repository: incubator-singa
Updated Branches:
  refs/heads/master a92a1c778 -> d5b6a30d0


SINGA-49 Fix a bug in HandlePutMsg func that sets param fields to invalid values

The Param::HandlePutMsg doesn't set the weight decay multiplier and learning rate multiplier correctly.
The previous code doesn't use the values from the received messages.
Fixed the bug using the correct multipliers.


Project: http://git-wip-us.apache.org/repos/asf/incubator-singa/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-singa/commit/d5b6a30d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-singa/tree/d5b6a30d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-singa/diff/d5b6a30d

Branch: refs/heads/master
Commit: d5b6a30d0efd207da143d01ca4079f2caa2ba5f7
Parents: a92a1c7
Author: Wei Wang <wa...@comp.nus.edu.sg>
Authored: Wed Aug 12 15:29:37 2015 +0800
Committer: Wei Wang <wa...@comp.nus.edu.sg>
Committed: Wed Aug 12 15:29:37 2015 +0800

----------------------------------------------------------------------
 Makefile.example          | 2 +-
 examples/cifar10/job.conf | 2 +-
 src/utils/param.cc        | 8 ++++----
 3 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/d5b6a30d/Makefile.example
----------------------------------------------------------------------
diff --git a/Makefile.example b/Makefile.example
index 79201cb..dc09946 100644
--- a/Makefile.example
+++ b/Makefile.example
@@ -18,7 +18,7 @@ LDFLAGS := $(foreach librarydir, $(LIBRARY_DIRS), -L$(librarydir))\
 BUILD_DIR := .libs
 MSHADOW_FLAGS :=-DMSHADOW_USE_CUDA=0 -DMSHADOW_USE_CBLAS=1 -DMSHADOW_USE_MKL=0
 ZK_FLAGS :=-DTHREADED -fpermissive
-CXXFLAGS := -O3 -Wall -pthread -fPIC -std=c++11 -Wno-unknown-pragmas \
+CXXFLAGS := -O2 -msse3 -Wall -pthread -fPIC -std=c++11 -Wno-unknown-pragmas \
 	$(MSHADOW_FLAGS) -DCPU_ONLY=1 $(ZK_FLAGS)\
 	-funroll-loops $(foreach includedir, $(INCLUDE_DIRS), -I$(includedir))
 

http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/d5b6a30d/examples/cifar10/job.conf
----------------------------------------------------------------------
diff --git a/examples/cifar10/job.conf b/examples/cifar10/job.conf
index f3b21b8..2541330 100644
--- a/examples/cifar10/job.conf
+++ b/examples/cifar10/job.conf
@@ -140,7 +140,7 @@ model {
     type: kPooling
     srclayers: "relu2"
     pooling_conf {
-      pool: MAX
+      pool: AVE
       kernel: 3
       stride: 2
     }

http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/d5b6a30d/src/utils/param.cc
----------------------------------------------------------------------
diff --git a/src/utils/param.cc b/src/utils/param.cc
index 4932221..8c0b440 100644
--- a/src/utils/param.cc
+++ b/src/utils/param.cc
@@ -18,7 +18,7 @@ void Param::Setup(const ParamProto& proto, const vector<int>& shape){
   data_=std::make_shared<Blob<float>>(shape);
   grad_.Reshape(shape);
   history_.Reshape(shape);
-  proto_=proto;
+  proto_.CopyFrom(proto);
 }
 
 void Param::AddSlice(int slice_id, int size){
@@ -146,10 +146,10 @@ Msg* Param::HandlePutMsg(Msg** msg, bool reserve) {
   float lr, wc;
   float* ptr;
   (*msg)->ParseFormatFrame("iffp", &size, &lr, &wc, &ptr);
-  proto_.set_learning_rate_multiplier(lr);
-  proto_.set_weight_decay_multiplier(wc);
-  vector<int> shape{size};
   ParamProto proto;
+  proto.set_learning_rate_multiplier(lr);
+  proto.set_weight_decay_multiplier(wc);
+  vector<int> shape{size};
   Setup(proto, shape);
   if (ptr == nullptr) {
     CHECK((*msg)->NextFrame());