提交 57c355a1 编写于 作者: G gaoyuan

Remove redundancy codes

上级 549cf641
...@@ -21,7 +21,6 @@ namespace paddle { ...@@ -21,7 +21,6 @@ namespace paddle {
void CrossChannelNormLayer::forward(PassType passType) { void CrossChannelNormLayer::forward(PassType passType) {
Layer::forward(passType); Layer::forward(passType);
auto in = getInput(0);
MatrixPtr inV = getInputValue(0); MatrixPtr inV = getInputValue(0);
size_t batchSize = inV->getHeight(); size_t batchSize = inV->getHeight();
...@@ -36,7 +35,6 @@ void CrossChannelNormLayer::forward(PassType passType) { ...@@ -36,7 +35,6 @@ void CrossChannelNormLayer::forward(PassType passType) {
Matrix::resizeOrCreate(spatialBuffer_, 1, spatialDim, false, useGpu_); Matrix::resizeOrCreate(spatialBuffer_, 1, spatialDim, false, useGpu_);
Matrix::resizeOrCreate(normBuffer_, batchSize, spatialDim, false, useGpu_); Matrix::resizeOrCreate(normBuffer_, batchSize, spatialDim, false, useGpu_);
normBuffer_->zeroMem(); normBuffer_->zeroMem();
spatialBuffer_->zeroMem();
dataBuffer_->zeroMem(); dataBuffer_->zeroMem();
// add eps to avoid overflow // add eps to avoid overflow
normBuffer_->addScalar(*normBuffer_, 1e-6); normBuffer_->addScalar(*normBuffer_, 1e-6);
...@@ -71,7 +69,6 @@ void CrossChannelNormLayer::backward(const UpdateCallback& callback) { ...@@ -71,7 +69,6 @@ void CrossChannelNormLayer::backward(const UpdateCallback& callback) {
MatrixPtr outG = getOutputGrad(); MatrixPtr outG = getOutputGrad();
MatrixPtr outV = getOutputValue(); MatrixPtr outV = getOutputValue();
auto in = getInput(0);
size_t batchSize = inG->getHeight(); size_t batchSize = inG->getHeight();
size_t dataDim = inG->getWidth(); size_t dataDim = inG->getWidth();
size_t spatialDim = dataDim / channels_; size_t spatialDim = dataDim / channels_;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册