|
|
@ -1196,7 +1196,8 @@ struct Net::Impl |
|
|
|
// some other layers.
|
|
|
|
// some other layers.
|
|
|
|
|
|
|
|
|
|
|
|
// TODO: OpenCL target support more fusion styles.
|
|
|
|
// TODO: OpenCL target support more fusion styles.
|
|
|
|
if ( preferableTarget == DNN_TARGET_OPENCL && ld.layerInstance->type.compare("Convolution") ) |
|
|
|
if ( preferableTarget == DNN_TARGET_OPENCL && |
|
|
|
|
|
|
|
(!cv::ocl::useOpenCL() || ld.layerInstance->type.compare("Convolution")) ) |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
|
|
Ptr<Layer>& currLayer = ld.layerInstance; |
|
|
|
Ptr<Layer>& currLayer = ld.layerInstance; |
|
|
@ -1214,6 +1215,9 @@ struct Net::Impl |
|
|
|
{ |
|
|
|
{ |
|
|
|
printf_(("\tfused with %s\n", nextBNormLayer->name.c_str())); |
|
|
|
printf_(("\tfused with %s\n", nextBNormLayer->name.c_str())); |
|
|
|
bnormData->skipFlags[DNN_BACKEND_DEFAULT] = true; |
|
|
|
bnormData->skipFlags[DNN_BACKEND_DEFAULT] = true; |
|
|
|
|
|
|
|
if ( preferableTarget == DNN_TARGET_OPENCL ) |
|
|
|
|
|
|
|
ld.umat_outputBlobs = layers[lpNext.lid].umat_outputBlobs; |
|
|
|
|
|
|
|
else |
|
|
|
ld.outputBlobs = layers[lpNext.lid].outputBlobs; |
|
|
|
ld.outputBlobs = layers[lpNext.lid].outputBlobs; |
|
|
|
if( bnormData->consumers.size() == 1 ) |
|
|
|
if( bnormData->consumers.size() == 1 ) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -1234,6 +1238,9 @@ struct Net::Impl |
|
|
|
{ |
|
|
|
{ |
|
|
|
printf_(("\tfused with %s\n", nextScaleLayer->name.c_str())); |
|
|
|
printf_(("\tfused with %s\n", nextScaleLayer->name.c_str())); |
|
|
|
scaleData->skipFlags[DNN_BACKEND_DEFAULT] = true; |
|
|
|
scaleData->skipFlags[DNN_BACKEND_DEFAULT] = true; |
|
|
|
|
|
|
|
if ( preferableTarget == DNN_TARGET_OPENCL ) |
|
|
|
|
|
|
|
ld.umat_outputBlobs = layers[lpNext.lid].umat_outputBlobs; |
|
|
|
|
|
|
|
else |
|
|
|
ld.outputBlobs = layers[lpNext.lid].outputBlobs; |
|
|
|
ld.outputBlobs = layers[lpNext.lid].outputBlobs; |
|
|
|
if( scaleData->consumers.size() == 1 ) |
|
|
|
if( scaleData->consumers.size() == 1 ) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -1263,6 +1270,9 @@ struct Net::Impl |
|
|
|
LayerData *activData = nextData; |
|
|
|
LayerData *activData = nextData; |
|
|
|
printf_(("\tfused with %s\n", nextActivLayer->name.c_str())); |
|
|
|
printf_(("\tfused with %s\n", nextActivLayer->name.c_str())); |
|
|
|
activData->skipFlags[DNN_BACKEND_DEFAULT] = true; |
|
|
|
activData->skipFlags[DNN_BACKEND_DEFAULT] = true; |
|
|
|
|
|
|
|
if ( preferableTarget == DNN_TARGET_OPENCL ) |
|
|
|
|
|
|
|
ld.umat_outputBlobs = layers[lpNext.lid].umat_outputBlobs; |
|
|
|
|
|
|
|
else |
|
|
|
ld.outputBlobs = layers[lpNext.lid].outputBlobs; |
|
|
|
ld.outputBlobs = layers[lpNext.lid].outputBlobs; |
|
|
|
|
|
|
|
|
|
|
|
if ( preferableTarget == DNN_TARGET_OPENCL ) |
|
|
|
if ( preferableTarget == DNN_TARGET_OPENCL ) |
|
|
@ -1325,13 +1335,13 @@ struct Net::Impl |
|
|
|
!nextData->type.compare("Power")) && |
|
|
|
!nextData->type.compare("Power")) && |
|
|
|
currLayer->setActivation(nextActivLayer) ) |
|
|
|
currLayer->setActivation(nextActivLayer) ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
CV_Assert(firstConvLayerData->outputBlobs.size() == 1 && ld.inputBlobs.size() == 1); |
|
|
|
CV_Assert(firstConvLayerData->umat_outputBlobs.size() == 1 && ld.umat_inputBlobs.size() == 1); |
|
|
|
ld.inputBlobs.push_back(&firstConvLayerData->outputBlobs[0]); |
|
|
|
ld.umat_inputBlobs.push_back(firstConvLayerData->umat_outputBlobs[0]); |
|
|
|
printf_(("\tfused with %s\n", nextEltwiseLayer->name.c_str())); |
|
|
|
printf_(("\tfused with %s\n", nextEltwiseLayer->name.c_str())); |
|
|
|
printf_(("\tfused with %s\n", nextActivLayer->name.c_str())); |
|
|
|
printf_(("\tfused with %s\n", nextActivLayer->name.c_str())); |
|
|
|
eltwiseData->skipFlags[DNN_BACKEND_DEFAULT] = true; |
|
|
|
eltwiseData->skipFlags[DNN_BACKEND_DEFAULT] = true; |
|
|
|
nextData->skipFlags[DNN_BACKEND_DEFAULT] = true; |
|
|
|
nextData->skipFlags[DNN_BACKEND_DEFAULT] = true; |
|
|
|
ld.outputBlobs = layers[lpNext.lid].outputBlobs; |
|
|
|
ld.umat_outputBlobs = layers[lpNext.lid].umat_outputBlobs; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|