mirror of
https://github.com/opencv/opencv.git
synced 2025-06-18 16:11:50 +08:00
Merge pull request #18246 from YashasSamaga:dnn-permute-fix-unwanted-ocl-init
This commit is contained in:
commit
64c67a93d3
@ -174,21 +174,9 @@ public:
|
|||||||
computeStrides(shape(inputs[0]), shape(outputs[0]));
|
computeStrides(shape(inputs[0]), shape(outputs[0]));
|
||||||
|
|
||||||
#ifdef HAVE_OPENCL
|
#ifdef HAVE_OPENCL
|
||||||
if (uorder.empty())
|
uorder.release();
|
||||||
{
|
uold_stride.release();
|
||||||
std::vector<int> orderVec(_order.begin(), _order.end());;
|
unew_stride.release();
|
||||||
Mat morder(1, orderVec.size(), CV_32SC1, &orderVec[0]);
|
|
||||||
|
|
||||||
std::vector<int> oldStrideVec(_oldStride.begin(), _oldStride.end());
|
|
||||||
Mat mold_stride(1, _oldStride.size(), CV_32SC1, &oldStrideVec[0]);
|
|
||||||
|
|
||||||
std::vector<int> newStrideVec(_newStride.begin(), _newStride.end());
|
|
||||||
Mat mnew_stride(1, newStrideVec.size(), CV_32SC1, &newStrideVec[0]);
|
|
||||||
|
|
||||||
morder.copyTo(uorder);
|
|
||||||
mold_stride.copyTo(uold_stride);
|
|
||||||
mnew_stride.copyTo(unew_stride);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -276,6 +264,22 @@ public:
|
|||||||
if (!_needsPermute)
|
if (!_needsPermute)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (uorder.empty())
|
||||||
|
{
|
||||||
|
std::vector<int> orderVec(_order.begin(), _order.end());;
|
||||||
|
Mat morder(1, orderVec.size(), CV_32SC1, &orderVec[0]);
|
||||||
|
|
||||||
|
std::vector<int> oldStrideVec(_oldStride.begin(), _oldStride.end());
|
||||||
|
Mat mold_stride(1, _oldStride.size(), CV_32SC1, &oldStrideVec[0]);
|
||||||
|
|
||||||
|
std::vector<int> newStrideVec(_newStride.begin(), _newStride.end());
|
||||||
|
Mat mnew_stride(1, newStrideVec.size(), CV_32SC1, &newStrideVec[0]);
|
||||||
|
|
||||||
|
morder.copyTo(uorder);
|
||||||
|
mold_stride.copyTo(uold_stride);
|
||||||
|
mnew_stride.copyTo(unew_stride);
|
||||||
|
}
|
||||||
|
|
||||||
bool use_half = (inps.depth() == CV_16S);
|
bool use_half = (inps.depth() == CV_16S);
|
||||||
String opts = format("-DDtype=%s", use_half ? "half" : "float");
|
String opts = format("-DDtype=%s", use_half ? "half" : "float");
|
||||||
for (size_t i = 0; i < inputs.size(); i++)
|
for (size_t i = 0; i < inputs.size(); i++)
|
||||||
|
@ -2343,7 +2343,7 @@ TEST_P(ConvolutionEltwiseActivationFusion, Accuracy)
|
|||||||
if (eltwiseOp != "sum" && weightedEltwise)
|
if (eltwiseOp != "sum" && weightedEltwise)
|
||||||
throw SkipTestException("weighted eltwise not supported");
|
throw SkipTestException("weighted eltwise not supported");
|
||||||
LayerParams eltwiseParams;
|
LayerParams eltwiseParams;
|
||||||
TestLayerFusion::makeDefaultTestEltwiseLayer(eltwiseParams, eltwiseOp, false);
|
TestLayerFusion::makeDefaultTestEltwiseLayer(eltwiseParams, eltwiseOp, weightedEltwise);
|
||||||
|
|
||||||
std::string actType = get<3>(GetParam());
|
std::string actType = get<3>(GetParam());
|
||||||
LayerParams activationParams;
|
LayerParams activationParams;
|
||||||
@ -2353,7 +2353,7 @@ TEST_P(ConvolutionEltwiseActivationFusion, Accuracy)
|
|||||||
Target targetId = get<1>(get<4>(GetParam()));
|
Target targetId = get<1>(get<4>(GetParam()));
|
||||||
|
|
||||||
// bug: https://github.com/opencv/opencv/issues/17945
|
// bug: https://github.com/opencv/opencv/issues/17945
|
||||||
if (eltwiseOp != "sum" && backendId == DNN_BACKEND_OPENCV && (targetId == DNN_TARGET_OPENCL || targetId == DNN_TARGET_OPENCL_FP16))
|
if ((eltwiseOp != "sum" || weightedEltwise) && backendId == DNN_BACKEND_OPENCV && (targetId == DNN_TARGET_OPENCL || targetId == DNN_TARGET_OPENCL_FP16))
|
||||||
applyTestTag(CV_TEST_TAG_DNN_SKIP_OPENCL);
|
applyTestTag(CV_TEST_TAG_DNN_SKIP_OPENCL);
|
||||||
|
|
||||||
// bug: https://github.com/opencv/opencv/issues/17953
|
// bug: https://github.com/opencv/opencv/issues/17953
|
||||||
@ -2440,7 +2440,7 @@ TEST_P(ConvolutionActivationEltwiseFusion, Accuracy)
|
|||||||
if (eltwiseOp != "sum" && weightedEltwise)
|
if (eltwiseOp != "sum" && weightedEltwise)
|
||||||
throw SkipTestException("weighted eltwise not supported");
|
throw SkipTestException("weighted eltwise not supported");
|
||||||
LayerParams eltwiseParams;
|
LayerParams eltwiseParams;
|
||||||
TestLayerFusion::makeDefaultTestEltwiseLayer(eltwiseParams, eltwiseOp, false);
|
TestLayerFusion::makeDefaultTestEltwiseLayer(eltwiseParams, eltwiseOp, weightedEltwise);
|
||||||
|
|
||||||
Backend backendId = get<0>(get<4>(GetParam()));
|
Backend backendId = get<0>(get<4>(GetParam()));
|
||||||
Target targetId = get<1>(get<4>(GetParam()));
|
Target targetId = get<1>(get<4>(GetParam()));
|
||||||
|
Loading…
Reference in New Issue
Block a user