Unverified Commit 94f26877 authored by Ilya Churaev's avatar Ilya Churaev Committed by GitHub

Revert "Stricter checks on padding attributes for v1::Convolution" (#4519)

* Revert "Change pad mode to explicit if pad values are set in validation (#4509)"

This reverts commit 2a8487e4.

* Revert "Stricter checks on padding attributes for v1::Convolution (#4350)"

This reverts commit 81d97948.
Co-authored-by: 's avatarScott Cyphers <diyessi@users.noreply.github.com>
parent e1ebbf12
...@@ -57,25 +57,6 @@ bool op::v1::Convolution::visit_attributes(AttributeVisitor& visitor) ...@@ -57,25 +57,6 @@ bool op::v1::Convolution::visit_attributes(AttributeVisitor& visitor)
void op::v1::Convolution::validate_and_infer_types() void op::v1::Convolution::validate_and_infer_types()
{ {
if (m_auto_pad != PadType::EXPLICIT)
{
NODE_VALIDATION_CHECK(this,
std::all_of(m_pads_begin.begin(),
m_pads_begin.end(),
[](std::ptrdiff_t i) { return (i == 0); }),
" ",
"pads_begin: (",
m_pads_begin,
") Non-zero padding should not be used along with auto pad modes.");
NODE_VALIDATION_CHECK(this,
std::all_of(m_pads_end.begin(),
m_pads_end.end(),
[](std::ptrdiff_t i) { return (i == 0); }),
" ",
"pads_end: (",
m_pads_end,
") Non-zero padding should not be used along with auto pad modes.");
}
const PartialShape& data_batch_shape = get_input_partial_shape(0); const PartialShape& data_batch_shape = get_input_partial_shape(0);
element::Type data_batch_et = get_input_element_type(0); element::Type data_batch_et = get_input_element_type(0);
const PartialShape& filters_shape = get_input_partial_shape(1); const PartialShape& filters_shape = get_input_partial_shape(1);
...@@ -116,8 +97,6 @@ void op::v1::Convolution::validate_and_infer_types() ...@@ -116,8 +97,6 @@ void op::v1::Convolution::validate_and_infer_types()
m_auto_pad, m_auto_pad,
m_pads_end, m_pads_end,
m_pads_begin); m_pads_begin);
// auto padding has now been made explicit, so set to explicit for future validations
m_auto_pad = PadType::EXPLICIT;
} }
} }
......
...@@ -2863,98 +2863,6 @@ TEST(type_prop, conv_v1_partial_rank) ...@@ -2863,98 +2863,6 @@ TEST(type_prop, conv_v1_partial_rank)
ASSERT_TRUE(conv->get_output_partial_shape(0).is_dynamic()); ASSERT_TRUE(conv->get_output_partial_shape(0).is_dynamic());
} }
TEST(type_prop, conv_v1_incorrect_auto_pad)
{
PartialShape data_batch_shape{
0, Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic()};
PartialShape filters_shape{PartialShape::dynamic()};
Strides window_movement_strides{1, 1};
Strides window_dilation_strides{1, 1};
CoordinateDiff pads_begin{0, 0};
CoordinateDiff pads_end{0, 0};
auto param0 = make_shared<op::Parameter>(element::f32, data_batch_shape);
auto param1 = make_shared<op::Parameter>(element::f32, filters_shape);
try
{
auto conv = make_shared<op::v1::Convolution>(param0,
param1,
window_movement_strides,
CoordinateDiff{1, 0},
pads_end,
window_dilation_strides,
op::PadType::VALID);
FAIL() << "Incorrect padding not detected";
}
catch (const NodeValidationFailure& error)
{
EXPECT_HAS_SUBSTRING(
error.what(),
std::string("Non-zero padding should not be used along with auto pad modes"));
}
catch (...)
{
FAIL() << "Deduced type check failed for unexpected reason";
}
try
{
auto conv = make_shared<op::v1::Convolution>(param0,
param1,
window_movement_strides,
pads_begin,
CoordinateDiff{0, -1},
window_dilation_strides,
op::PadType::VALID);
FAIL() << "Incorrect padding not detected";
}
catch (const NodeValidationFailure& error)
{
EXPECT_HAS_SUBSTRING(
error.what(),
std::string("Non-zero padding should not be used along with auto pad modes"));
}
catch (...)
{
FAIL() << "Deduced type check failed for unexpected reason";
}
}
TEST(type_prop, conv_double_validate_with_pad)
{
PartialShape data_batch_shape{1, 3, 64, 64};
PartialShape filters_shape{4, 3, 5, 5};
Strides window_movement_strides{1, 1};
Strides window_dilation_strides{1, 1};
CoordinateDiff pads_begin{0, 0};
CoordinateDiff pads_end{0, 0};
auto param0 = make_shared<op::Parameter>(element::f32, data_batch_shape);
auto param1 = make_shared<op::Parameter>(element::f32, filters_shape);
auto conv = make_shared<op::v1::Convolution>(param0,
param1,
window_movement_strides,
pads_begin,
pads_end,
window_dilation_strides,
op::PadType::SAME_UPPER);
ASSERT_EQ(conv->get_pads_begin()[0], 2);
ASSERT_EQ(conv->get_pads_begin()[1], 2);
ASSERT_EQ(conv->get_pads_end()[0], 2);
ASSERT_EQ(conv->get_pads_end()[1], 2);
try
{
conv->validate_and_infer_types();
}
catch (...)
{
FAIL() << "Double validate failure";
}
}
TEST(type_prop, deformable_conv_incorrect_group) TEST(type_prop, deformable_conv_incorrect_group)
{ {
const PartialShape data_batch_shape{1, 3, 96, 96}; const PartialShape data_batch_shape{1, 3, 96, 96};
......
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