提交 38cc5dad 编写于 作者: C chengduoZH

modified bias shape of ConvLayer

上级 0a7516d1
......@@ -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;
}
......
......@@ -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<Weight>(new Weight(numFilters_, 1, biasParameter_));
std::unique_ptr<Weight>(new Weight(1, numFilters_, biasParameter_));
} else {
biases_ =
std::unique_ptr<Weight>(new Weight(getSize(), 1, biasParameter_));
std::unique_ptr<Weight>(new Weight(1, getSize(), biasParameter_));
}
}
......
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册