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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user