mirror of
https://github.com/opencv/opencv.git
synced 2025-06-11 11:45:30 +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]));
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
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);
|
||||
}
|
||||
uorder.release();
|
||||
uold_stride.release();
|
||||
unew_stride.release();
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -276,6 +264,22 @@ public:
|
||||
if (!_needsPermute)
|
||||
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);
|
||||
String opts = format("-DDtype=%s", use_half ? "half" : "float");
|
||||
for (size_t i = 0; i < inputs.size(); i++)
|
||||
|
@ -2343,7 +2343,7 @@ TEST_P(ConvolutionEltwiseActivationFusion, Accuracy)
|
||||
if (eltwiseOp != "sum" && weightedEltwise)
|
||||
throw SkipTestException("weighted eltwise not supported");
|
||||
LayerParams eltwiseParams;
|
||||
TestLayerFusion::makeDefaultTestEltwiseLayer(eltwiseParams, eltwiseOp, false);
|
||||
TestLayerFusion::makeDefaultTestEltwiseLayer(eltwiseParams, eltwiseOp, weightedEltwise);
|
||||
|
||||
std::string actType = get<3>(GetParam());
|
||||
LayerParams activationParams;
|
||||
@ -2353,7 +2353,7 @@ TEST_P(ConvolutionEltwiseActivationFusion, Accuracy)
|
||||
Target targetId = get<1>(get<4>(GetParam()));
|
||||
|
||||
// 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);
|
||||
|
||||
// bug: https://github.com/opencv/opencv/issues/17953
|
||||
@ -2440,7 +2440,7 @@ TEST_P(ConvolutionActivationEltwiseFusion, Accuracy)
|
||||
if (eltwiseOp != "sum" && weightedEltwise)
|
||||
throw SkipTestException("weighted eltwise not supported");
|
||||
LayerParams eltwiseParams;
|
||||
TestLayerFusion::makeDefaultTestEltwiseLayer(eltwiseParams, eltwiseOp, false);
|
||||
TestLayerFusion::makeDefaultTestEltwiseLayer(eltwiseParams, eltwiseOp, weightedEltwise);
|
||||
|
||||
Backend backendId = get<0>(get<4>(GetParam()));
|
||||
Target targetId = get<1>(get<4>(GetParam()));
|
||||
|
Loading…
Reference in New Issue
Block a user