|
|
@ -49,7 +49,7 @@ bool MKLDNNFcLayer::init(const LayerMap& layerMap,
|
|
|
|
|
|
|
|
|
|
|
|
// create biases
|
|
|
|
// create biases
|
|
|
|
if (biasParameter_.get() != NULL) {
|
|
|
|
if (biasParameter_.get() != NULL) {
|
|
|
|
biases_ = std::unique_ptr<Weight>(new Weight(1, oc_, biasParameter_));
|
|
|
|
biases_ = std::unique_ptr<Weight>(new Weight(1, oc_, biasParameter_, 0));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -161,9 +161,16 @@ void MKLDNNFcLayer::resetInValue(MKLDNNMatrixPtr& in) {
|
|
|
|
|
|
|
|
|
|
|
|
void MKLDNNFcLayer::resetWgtBiasValue(MKLDNNMatrixPtr& wgt,
|
|
|
|
void MKLDNNFcLayer::resetWgtBiasValue(MKLDNNMatrixPtr& wgt,
|
|
|
|
MKLDNNMatrixPtr& bias) {
|
|
|
|
MKLDNNMatrixPtr& bias) {
|
|
|
|
|
|
|
|
format wgtFmt = format::oihw;
|
|
|
|
|
|
|
|
if (inVal_->getFormat() == format::nChw8c) {
|
|
|
|
|
|
|
|
wgtFmt = format::oIhw8i;
|
|
|
|
|
|
|
|
} else if (inVal_->getFormat() == format::nChw16c) {
|
|
|
|
|
|
|
|
wgtFmt = format::oIhw16i;
|
|
|
|
|
|
|
|
}
|
|
|
|
wgt = MKLDNNMatrix::create(
|
|
|
|
wgt = MKLDNNMatrix::create(
|
|
|
|
weight_->getW(), {oc_, ic_, ih_, iw_}, format::oihw, engine_);
|
|
|
|
weight_->getW(), {oc_, ic_, ih_, iw_}, wgtFmt, engine_);
|
|
|
|
wgt->downSpatial();
|
|
|
|
wgt->downSpatial();
|
|
|
|
|
|
|
|
VLOG(MKLDNN_FMTS) << "Weight value format: " << wgt->getFormat();
|
|
|
|
|
|
|
|
|
|
|
|
bias = (biases_ && biases_->getW())
|
|
|
|
bias = (biases_ && biases_->getW())
|
|
|
|
? MKLDNNMatrix::create(biases_->getW(), {oc_}, format::x, engine_)
|
|
|
|
? MKLDNNMatrix::create(biases_->getW(), {oc_}, format::x, engine_)
|
|
|
|