Migrate ngraph backend test/deformable convolution (#8045)

* Remove fp16 of Convert layer test from skip_tests.config.cpp as it works now

* update repo

* add initial version of op reference test of deformable convolution

* update reference test

* update reference test 2

* update deformable_convolution referencet est

* add deformable_convolution_opset8 op reference test

* update skip_test_config.cpp

* remove backend test and add visitor api test

* merge test code of deformable_convolution v1 and v8 in a single file

* merge deformable_convolition_opset8 of visitor api test into single file
This commit is contained in:
Wilson Seok 2021-10-20 01:19:19 -07:00 committed by GitHub
parent 17914d516a
commit 132ae33de0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 5871 additions and 5558 deletions

File diff suppressed because it is too large Load Diff

View File

@ -43,6 +43,12 @@ std::vector<std::string> disabledTestPatterns() {
R"(.*ReferenceLogSoftmaxLayerTest.*4.*iType=f16.*axis=.*1.*)", R"(.*ReferenceLogSoftmaxLayerTest.*4.*iType=f16.*axis=.*1.*)",
// CVS-64080 // CVS-64080
R"(.*ReferenceMishLayerTest.*dimensionDynamic.*)", R"(.*ReferenceMishLayerTest.*dimensionDynamic.*)",
//CVS-64012
R"(.*ReferenceDeformableConvolutionLayerTest.*f16.*real_offset_padding_stride_dialation.*)",
R"(.*ReferenceDeformableConvolutionLayerTest.*bf16.*)",
R"(.*ReferenceDeformableConvolutionV8LayerTest.*f16.*real_offset_padding_stride_dialation.*)",
R"(.*ReferenceDeformableConvolutionV8LayerTest.*bf16.*)",
R"(.*ReferenceDeformableConvolutionV8LayerTest.*f64.*mask.*)",
}; };
#ifdef _WIN32 #ifdef _WIN32

View File

@ -469,8 +469,6 @@ set(MULTI_TEST_SRC
backend/detection_output.in.cpp backend/detection_output.in.cpp
backend/dft.in.cpp backend/dft.in.cpp
backend/divide.in.cpp backend/divide.in.cpp
backend/deformable_convolution.in.cpp
backend/deformable_convolution_opset8.in.cpp
backend/depth_to_space.in.cpp backend/depth_to_space.in.cpp
backend/dyn_reshape.in.cpp backend/dyn_reshape.in.cpp
backend/experimental_detectron_generate_proposals.in.cpp backend/experimental_detectron_generate_proposals.in.cpp

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -5,6 +5,7 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "ngraph/op/util/attr_types.hpp" #include "ngraph/op/util/attr_types.hpp"
#include "ngraph/opsets/opset1.hpp"
#include "ngraph/opsets/opset8.hpp" #include "ngraph/opsets/opset8.hpp"
#include "util/visitor.hpp" #include "util/visitor.hpp"
@ -14,6 +15,70 @@ using ngraph::test::NodeBuilder;
using ngraph::test::ValueMap; using ngraph::test::ValueMap;
TEST(attributes, deformable_convolution_default_attributes) { TEST(attributes, deformable_convolution_default_attributes) {
NodeBuilder::get_ops().register_factory<opset1::DeformableConvolution>();
const Shape inputs_shape{1, 1, 5, 5};
auto data = make_shared<op::Parameter>(element::f32, Shape{1, 1, 5, 5});
auto filters = make_shared<op::Parameter>(element::f32, Shape{1, 1, 3, 3});
auto offsets = make_shared<op::Parameter>(element::f32, Shape{1, 18, 3, 3});
auto strides = Strides{1, 1};
auto pads_begin = CoordinateDiff{0, 0};
auto pads_end = CoordinateDiff{0, 0};
auto dilations = Strides{1, 1};
auto convolution =
make_shared<opset1::DeformableConvolution>(data, offsets, filters, strides, pads_begin, pads_end, dilations);
NodeBuilder builder(convolution);
auto g_convolution = ov::as_type_ptr<opset1::DeformableConvolution>(builder.create());
// attribute count
const auto expected_attr_count = 7;
EXPECT_EQ(builder.get_value_map_size(), expected_attr_count);
EXPECT_EQ(g_convolution->get_strides(), convolution->get_strides());
EXPECT_EQ(g_convolution->get_pads_begin(), convolution->get_pads_begin());
EXPECT_EQ(g_convolution->get_pads_end(), convolution->get_pads_end());
EXPECT_EQ(g_convolution->get_dilations(), convolution->get_dilations());
EXPECT_EQ(g_convolution->get_auto_pad(), convolution->get_auto_pad());
EXPECT_EQ(g_convolution->get_group(), convolution->get_group());
EXPECT_EQ(g_convolution->get_deformable_group(), convolution->get_deformable_group());
}
TEST(attributes, deformable_convolution_attributes) {
NodeBuilder::get_ops().register_factory<opset1::DeformableConvolution>();
const Shape inputs_shape{1, 1, 5, 5};
auto data = make_shared<op::Parameter>(element::f32, Shape{1, 2, 5, 5});
auto filters = make_shared<op::Parameter>(element::f32, Shape{2, 1, 3, 3});
auto offsets = make_shared<op::Parameter>(element::f32, Shape{1, 36, 5, 5});
auto strides = Strides{1, 1};
auto pads_begin = CoordinateDiff{0, 0};
auto pads_end = CoordinateDiff{0, 0};
auto dilations = Strides{1, 1};
auto convolution = make_shared<opset1::DeformableConvolution>(data,
offsets,
filters,
strides,
pads_begin,
pads_end,
dilations,
op::PadType::SAME_LOWER,
2,
2);
NodeBuilder builder(convolution);
auto g_convolution = ov::as_type_ptr<opset1::DeformableConvolution>(builder.create());
// attribute count
const auto expected_attr_count = 7;
EXPECT_EQ(builder.get_value_map_size(), expected_attr_count);
EXPECT_EQ(g_convolution->get_strides(), convolution->get_strides());
EXPECT_EQ(g_convolution->get_pads_begin(), convolution->get_pads_begin());
EXPECT_EQ(g_convolution->get_pads_end(), convolution->get_pads_end());
EXPECT_EQ(g_convolution->get_dilations(), convolution->get_dilations());
EXPECT_EQ(g_convolution->get_auto_pad(), convolution->get_auto_pad());
EXPECT_EQ(g_convolution->get_group(), convolution->get_group());
EXPECT_EQ(g_convolution->get_deformable_group(), convolution->get_deformable_group());
}
TEST(attributes, deformable_convolution_v8_default_attributes) {
NodeBuilder::get_ops().register_factory<opset8::DeformableConvolution>(); NodeBuilder::get_ops().register_factory<opset8::DeformableConvolution>();
const Shape inputs_shape{1, 1, 5, 5}; const Shape inputs_shape{1, 1, 5, 5};
auto data = make_shared<op::Parameter>(element::f32, Shape{1, 1, 5, 5}); auto data = make_shared<op::Parameter>(element::f32, Shape{1, 1, 5, 5});
@ -42,7 +107,7 @@ TEST(attributes, deformable_convolution_default_attributes) {
EXPECT_EQ(g_convolution->get_bilinear_interpolation_pad(), convolution->get_bilinear_interpolation_pad()); EXPECT_EQ(g_convolution->get_bilinear_interpolation_pad(), convolution->get_bilinear_interpolation_pad());
} }
TEST(attributes, deformable_convolution_attributes) { TEST(attributes, deformable_convolution_v8_attributes) {
NodeBuilder::get_ops().register_factory<opset8::DeformableConvolution>(); NodeBuilder::get_ops().register_factory<opset8::DeformableConvolution>();
const Shape inputs_shape{1, 1, 5, 5}; const Shape inputs_shape{1, 1, 5, 5};
auto data = make_shared<op::Parameter>(element::f32, Shape{1, 2, 5, 5}); auto data = make_shared<op::Parameter>(element::f32, Shape{1, 2, 5, 5});
@ -80,4 +145,4 @@ TEST(attributes, deformable_convolution_attributes) {
EXPECT_EQ(g_convolution->get_group(), convolution->get_group()); EXPECT_EQ(g_convolution->get_group(), convolution->get_group());
EXPECT_EQ(g_convolution->get_deformable_group(), convolution->get_deformable_group()); EXPECT_EQ(g_convolution->get_deformable_group(), convolution->get_deformable_group());
EXPECT_EQ(g_convolution->get_bilinear_interpolation_pad(), convolution->get_bilinear_interpolation_pad()); EXPECT_EQ(g_convolution->get_bilinear_interpolation_pad(), convolution->get_bilinear_interpolation_pad());
} }