1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 15:23:05 +04:00

convolution and tanh layer fusion

Signed-off-by: Li Peng <peng.li@intel.com>
This commit is contained in:
Li Peng
2018-01-23 20:44:28 +08:00
parent b97b650ab3
commit e15928b49e
5 changed files with 35 additions and 5 deletions
@@ -246,6 +246,11 @@ public:
power = activ_power->power;
activType = OCL4DNN_CONV_FUSED_ACTIV_POWER;
}
Ptr<TanHLayer> activ_tanh = activ.dynamicCast<TanHLayer>();
if (!activ_tanh.empty())
{
activType = OCL4DNN_CONV_FUSED_ACTIV_TANH;
}
}
#endif
return !activ.empty();
@@ -877,11 +882,16 @@ public:
{
convolutionOp->setActivPower(true, power);
}
else if ( activType == OCL4DNN_CONV_FUSED_ACTIV_TANH)
{
convolutionOp->setActivTanh(true);
}
else
{
convolutionOp->setActivReLU(false, 0);
convolutionOp->setActivPReLU(false, reluslope);
convolutionOp->setActivPower(false, 1.f);
convolutionOp->setActivTanh(false);
}
newActiv = false;
}