Commit ee743afe authored by Alexander Alekhin's avatar Alexander Alekhin

dnn(ocl): don't use getUMat() for long live objects

parent 767b31cf
......@@ -866,6 +866,16 @@ public:
for (int i = 0; i < inputs.size(); ++i)
CV_Assert(inputs[i].u != outputs[0].u);
if (umat_blobs.empty())
{
size_t n = blobs.size();
umat_blobs.resize(n);
for (size_t i = 0; i < n; i++)
{
blobs[i].copyTo(umat_blobs[i]);
}
}
if (convolutionOp.empty())
{
OCL4DNNConvConfig config;
......@@ -1637,14 +1647,6 @@ public:
Ptr<BaseConvolutionLayer> ConvolutionLayer::create(const LayerParams &params)
{
Ptr<ConvolutionLayerImpl> l(new ConvolutionLayerImpl(params));
#ifdef HAVE_OPENCL
size_t n = params.blobs.size();
l->umat_blobs.resize(n);
for (int i = 0; i < n; i++)
l->umat_blobs[i] = params.blobs[i].getUMat(ACCESS_READ);
#endif
return l;
}
......
......@@ -563,10 +563,10 @@ bool OCL4DNNConvSpatial<Dtype>::Forward(const UMat& bottom,
}
if (use_half_ && bias_half.empty() && !bias.empty())
convertFp16((UMat&)bias, bias_half);
convertFp16(bias, bias_half);
if (use_half_ && weights_half.empty())
convertFp16((UMat&)weight, weights_half);
convertFp16(weight, weights_half);
prepareKernel(bottom, top, weight, (use_half_) ? bias_half : bias, numImages);
if (bestKernelConfig.empty())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment