1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-31 00:03:03 +04:00

dnn(ocl4dnn): don't use getUMat()

especially in CPU only processing
This commit is contained in:
Alexander Alekhin
2018-10-05 15:10:58 +03:00
parent 0101fa789c
commit 9d02d42afe
7 changed files with 48 additions and 20 deletions
@@ -969,11 +969,12 @@ struct ChannelsPReLUFunctor
{
typedef ChannelsPReLULayer Layer;
Mat scale;
#ifdef HAVE_OPENCL
UMat scale_umat;
#endif
explicit ChannelsPReLUFunctor(const Mat& scale_=Mat()) : scale(scale_)
{
scale_umat = scale.getUMat(ACCESS_READ);
}
bool supportBackend(int backendId, int)
@@ -1021,6 +1022,9 @@ struct ChannelsPReLUFunctor
#ifdef HAVE_OPENCL
bool applyOCL(InputArrayOfArrays inps, OutputArrayOfArrays outs, OutputArrayOfArrays internals)
{
if (scale_umat.empty())
scale.copyTo(scale_umat);
std::vector<UMat> inputs;
std::vector<UMat> outputs;