提交 003609e5 编写于 作者: A Alexander Alekhin

Merge pull request #20838 from alalek:fix_20833

......@@ -46,6 +46,7 @@
#include "../op_inf_engine.hpp"
#include "../ie_ngraph.hpp"
#include <opencv2/core/utils/configuration.private.hpp>
#include <opencv2/core/utils/logger.hpp>
#include "opencv2/core/hal/hal.hpp"
......@@ -1494,7 +1495,26 @@ public:
config.pad = pad;
config.stride = stride;
config.dilation = dilation;
if (inputs[0].dims != 4 && inputs[0].dims != umat_blobs[0].dims)
{
static bool bypassCheck = utils::getConfigurationParameterBool("OPENCV_OCL4DNN_CONVOLUTION_IGNORE_INPUT_DIMS_4_CHECK", false);
if (!bypassCheck)
{
CV_LOG_ERROR(NULL, "DNN/OpenCL: Unsupported configuration: inputs[0].dims=" << inputs[0].dims << " umat_blobs[0].dims=" << umat_blobs[0].dims
<< ". Consider reporting complete reproducer to https://github.com/opencv/opencv/issues/20833."
<< " You can skip this check temporary through OPENCV_OCL4DNN_CONVOLUTION_IGNORE_INPUT_DIMS_4_CHECK=1"
);
return false;
}
}
config.group = inputs[0].size[1] / umat_blobs[0].size[1];
if (config.group < 1) // config.group == 0 causes div by zero in ocl4dnn code
{
CV_LOG_WARNING(NULL, "DNN/OpenCL: Unsupported config.group=" << config.group
<< ". Consider reporting complete reproducer to https://github.com/opencv/opencv/issues/20833"
);
return false;
}
config.bias_term = umat_blobs.size() == 2;
config.use_half = use_half;
......
......@@ -167,6 +167,7 @@ OCL4DNNConvSpatial<Dtype>::OCL4DNNConvSpatial(OCL4DNNConvConfig config)
channels_ = config.in_shape[dims - spatial_dims - 1];
num_output_ = config.out_shape[dims - spatial_dims - 1];
group_ = config.group;
CV_CheckGT(group_, 0, ""); // avoid div by zero below
fused_activ_ = OCL4DNN_CONV_FUSED_ACTIV_NONE;
fused_eltwise_ = false;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册