diff --git a/paddle/gserver/layers/Conv3DLayer.cpp b/paddle/gserver/layers/Conv3DLayer.cpp index 5609a4cc73562665c1f4ca25fefe9bd64cf195fa..106909824dfff69ca142162850843cde622b39f0 100644 --- a/paddle/gserver/layers/Conv3DLayer.cpp +++ b/paddle/gserver/layers/Conv3DLayer.cpp @@ -37,11 +37,6 @@ bool Conv3DLayer::init(const LayerMap &layerMap, weights_[index]->getWGrad()->getHeight()); ++index; } - if (nullptr != biases_->getWGrad()) - biases_->getWGrad()->reshape(biases_->getWGrad()->width_, - biases_->getWGrad()->height_); - if (nullptr != biases_->getW()) - biases_->getW()->reshape(biases_->getW()->width_, biases_->getW()->height_); CHECK(inputLayers_.size() == parameters_.size()); return true; } diff --git a/paddle/gserver/layers/ConvBaseLayer.cpp b/paddle/gserver/layers/ConvBaseLayer.cpp index e437b0b86e0de9a302baf1a48272117b90d7d383..6bcbe0ddb2d3abab52ecefb7c90151b3b6d2fb56 100644 --- a/paddle/gserver/layers/ConvBaseLayer.cpp +++ b/paddle/gserver/layers/ConvBaseLayer.cpp @@ -21,11 +21,10 @@ bool ConvBaseLayer::init(const LayerMap& layerMap, const ParameterMap& parameterMap) { /* Initialize the basic parent class */ Layer::init(layerMap, parameterMap); - isDeconv_ = (config_.type() == "exconv" || - config_.type() == "cudnn_conv" || - config_.type() == "conv3d" || - config_.type() == "deconv3d" ) - ? false : true; + isDeconv_ = (config_.type() == "exconv" || config_.type() == "cudnn_conv" || + config_.type() == "conv3d" || config_.type() == "deconv3d") + ? false + : true; /* Initialize the convolutional layer parameter */ numFilters_ = config_.num_filters(); @@ -52,8 +51,8 @@ bool ConvBaseLayer::init(const LayerMap& layerMap, filterSizeZ_.push_back(conf.filter_size_z()); imgSizeD_.push_back(conf.img_size_z()); outputD_.push_back(conf.output_z()); - filterPixels_.push_back( - filterSize_.back() * filterSizeY_.back() * filterSizeZ_.back()); + filterPixels_.push_back(filterSize_.back() * filterSizeY_.back() * + filterSizeZ_.back()); } CHECK(inputLayers_.size() == parameters_.size()); @@ -73,10 +72,10 @@ bool ConvBaseLayer::init(const LayerMap& layerMap, if (sharedBiases_) { CHECK_EQ((size_t)numFilters_, biasParameter_->getSize()); biases_ = - std::unique_ptr(new Weight(numFilters_, 1, biasParameter_)); + std::unique_ptr(new Weight(1, numFilters_, biasParameter_)); } else { biases_ = - std::unique_ptr(new Weight(getSize(), 1, biasParameter_)); + std::unique_ptr(new Weight(1, getSize(), biasParameter_)); } } diff --git a/paddle/gserver/layers/DeConv3DLayer.cpp b/paddle/gserver/layers/DeConv3DLayer.cpp index 286f5b985c38e4f65ef807d60c323bed4e230311..5a54a684471cb62538be0f217f2e1666a65e46e2 100644 --- a/paddle/gserver/layers/DeConv3DLayer.cpp +++ b/paddle/gserver/layers/DeConv3DLayer.cpp @@ -39,11 +39,6 @@ bool DeConv3DLayer::init(const LayerMap &layerMap, weights_[index]->getWGrad()->reshape(filterPixels_[index] * numFilters_, filterChannels_[index]); } - if (biases_->getWGrad()) - biases_->getWGrad()->reshape(biases_->getWGrad()->width_, - biases_->getWGrad()->height_); - if (biases_->getW()) - biases_->getW()->reshape(biases_->getW()->width_, biases_->getW()->height_); CHECK(inputLayers_.size() == parameters_.size()); return true; }