From d456c286093ca6c74f7c6d02b67d3339877f564a Mon Sep 17 00:00:00 2001
From: hedaoyuan <hedaoyuan@github.com>
Date: Tue, 1 Aug 2017 13:50:05 +0800
Subject: [PATCH] Fix some bug.

---
 paddle/gserver/layers/SliceProjection.cpp | 2 +-
 paddle/gserver/tests/test_LayerGrad.cpp   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/paddle/gserver/layers/SliceProjection.cpp b/paddle/gserver/layers/SliceProjection.cpp
index a361d19bde4..267dd6154b1 100644
--- a/paddle/gserver/layers/SliceProjection.cpp
+++ b/paddle/gserver/layers/SliceProjection.cpp
@@ -87,7 +87,7 @@ void SliceProjection::backward(const UpdateCallback& callback) {
     size_t offset = 0;
     for (auto& slice : slices_) {
       auto slice_out = in_->grad->subColMatrix(slice.first, slice.second);
-      slice_out->addAtOffset(*out_->grad, config_.offset());
+      slice_out->addAtOffset(*out_->grad, offset);
       offset += slice_out->getWidth();
     }
   }
diff --git a/paddle/gserver/tests/test_LayerGrad.cpp b/paddle/gserver/tests/test_LayerGrad.cpp
index 00ca4982e9a..8ce8600c674 100644
--- a/paddle/gserver/tests/test_LayerGrad.cpp
+++ b/paddle/gserver/tests/test_LayerGrad.cpp
@@ -167,7 +167,7 @@ TEST(Projection, slice) {
     testProjectionGrad(conf,
                        INPUT_DATA,
                        /* parameterSize */ 0,
-                       /* batchSize */ 100,
+                       /* batchSize */ 10,
                        useGpu);
   }
 }
-- 
GitLab