Unverified Commit 718d7e4b authored by Liubov Batanina's avatar Liubov Batanina Committed by GitHub

Merge pull request #16715 from l-bat:slice_onnx

* Support Slice layer with multiple inputs

* Add test

* Supported Resize from PyTorch

* Rewrite test

* Remove Cast layer (supported in #16735)

* Support ConstantOfShape

* Fix tests

* Fix coments

* Remove useless condition

* Fixed failed tests
parent 1d7bfcc9
This diff is collapsed.
...@@ -57,8 +57,13 @@ public: ...@@ -57,8 +57,13 @@ public:
net.setPreferableBackend(backend); net.setPreferableBackend(backend);
net.setPreferableTarget(target); net.setPreferableTarget(target);
std::vector<String> inputNames;
for (int i = 0; i < numInps; ++i) for (int i = 0; i < numInps; ++i)
net.setInput(inps[i], numInps > 1 ? format("%d", i) : ""); inputNames.push_back(format("%d", i));
net.setInputsNames(inputNames);
for (int i = 0; i < numInps; ++i)
net.setInput(inps[i], inputNames[i]);
Mat out = net.forward(""); Mat out = net.forward("");
if (useSoftmax) if (useSoftmax)
...@@ -166,6 +171,11 @@ TEST_P(Test_ONNX_layers, Clip) ...@@ -166,6 +171,11 @@ TEST_P(Test_ONNX_layers, Clip)
testONNXModels("clip", npy); testONNXModels("clip", npy);
} }
TEST_P(Test_ONNX_layers, Shape)
{
testONNXModels("shape_of_constant");
}
TEST_P(Test_ONNX_layers, ReduceMean) TEST_P(Test_ONNX_layers, ReduceMean)
{ {
testONNXModels("reduce_mean"); testONNXModels("reduce_mean");
...@@ -347,6 +357,11 @@ TEST_P(Test_ONNX_layers, Broadcast) ...@@ -347,6 +357,11 @@ TEST_P(Test_ONNX_layers, Broadcast)
testONNXModels("channel_broadcast", npy, 0, 0, false, true, 2); testONNXModels("channel_broadcast", npy, 0, 0, false, true, 2);
} }
TEST_P(Test_ONNX_layers, DynamicResize)
{
testONNXModels("dynamic_resize", npy, 0, 0, false, true, 2);
}
TEST_P(Test_ONNX_layers, Div) TEST_P(Test_ONNX_layers, Div)
{ {
const String model = _tf("models/div.onnx"); const String model = _tf("models/div.onnx");
...@@ -375,10 +390,8 @@ TEST_P(Test_ONNX_layers, Div) ...@@ -375,10 +390,8 @@ TEST_P(Test_ONNX_layers, Div)
TEST_P(Test_ONNX_layers, DynamicReshape) TEST_P(Test_ONNX_layers, DynamicReshape)
{ {
if (backend == DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019) if (backend == DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019)
{ applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER);
if (target == DNN_TARGET_OPENCL_FP16) applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_OPENCL_FP16, CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER);
if (target == DNN_TARGET_OPENCL) applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_OPENCL, CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER);
}
testONNXModels("dynamic_reshape"); testONNXModels("dynamic_reshape");
testONNXModels("dynamic_reshape_opset_11"); testONNXModels("dynamic_reshape_opset_11");
testONNXModels("flatten_by_prod"); testONNXModels("flatten_by_prod");
...@@ -418,6 +431,7 @@ TEST_P(Test_ONNX_layers, Slice) ...@@ -418,6 +431,7 @@ TEST_P(Test_ONNX_layers, Slice)
testONNXModels("slice", npy, 0, 0, false, false); testONNXModels("slice", npy, 0, 0, false, false);
#else #else
testONNXModels("slice"); testONNXModels("slice");
testONNXModels("slice_opset_11");
#endif #endif
} }
......
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