fix ReverseShapeAndTypeInfer; add unit test (#18319)
Co-authored-by: Ivan Tikhonov <ivan.tikhonov@intel.com>
This commit is contained in:
1 parent
79c37882aa
commit
0cd4ea29ce
2 files changed
+25
-1
No files matched your search
+2
-1
@@ -6,6 +6,7 @@
|
||||
|
||||
#include "itt.hpp"
|
||||
#include "openvino/core/validation_util.hpp"
|
||||
#include "openvino/op/util/pad_base.hpp"
|
||||
#include "openvino/opsets/opset10.hpp"
|
||||
|
||||
using namespace ov::opset10;
|
||||
@@ -108,7 +109,7 @@ bool ov::pass::ReverseShapeAndTypeInfer::run_on_model(const std::shared_ptr<ov::
|
||||
} else if (std::dynamic_pointer_cast<DeformableConvolution>(op)) {
|
||||
is_changed |= inherit_output_rank(op, {0, 1, 2, 3});
|
||||
is_changed |= inherit_output_type(op, {0, 1, 2, 3});
|
||||
} else if (std::dynamic_pointer_cast<Pad>(op)) {
|
||||
} else if (std::dynamic_pointer_cast<ov::op::util::PadBase>(op)) {
|
||||
// Shape of pads_begin and pads_end must match rank of input
|
||||
if (op->get_input_partial_shape(0).rank().is_dynamic()) {
|
||||
auto pads_begin_shape = op->get_input_partial_shape(1);
|
||||
|
||||
+23
@@ -8,6 +8,7 @@
|
||||
#include <transformations/common_optimizations/reverse_shape_and_type_infer.hpp>
|
||||
|
||||
#include "common_test_utils/ngraph_test_utils.hpp"
|
||||
#include "openvino/opsets/opset12.hpp"
|
||||
|
||||
using namespace testing;
|
||||
using namespace ov;
|
||||
@@ -194,6 +195,28 @@ TEST_F(TransformationTestsF, PadReverseInfer) {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(TransformationTestsF, NegativePad12ReverseInfer) {
|
||||
{
|
||||
auto data = std::make_shared<opset10::Parameter>(element::dynamic, PartialShape::dynamic());
|
||||
auto pads_begin = opset10::Constant::create(element::i64, Shape{4}, {0, 0, 0, -1});
|
||||
auto pads_end = opset10::Constant::create(element::i64, Shape{4}, {0, 0, 0, -1});
|
||||
auto value = opset10::Constant::create(element::f32, Shape{}, {0});
|
||||
auto pad = std::make_shared<ov::op::v12::Pad>(data, pads_begin, pads_end, value, op::PadMode::CONSTANT);
|
||||
auto result = std::make_shared<opset10::Result>(pad);
|
||||
model = std::make_shared<Model>(ResultVector{result}, ParameterVector{data});
|
||||
manager.register_pass<pass::ReverseShapeAndTypeInfer>();
|
||||
}
|
||||
{
|
||||
auto data = std::make_shared<opset10::Parameter>(element::f32, PartialShape::dynamic(4));
|
||||
auto pads_begin = opset10::Constant::create(element::i64, Shape{4}, {0, 0, 0, -1});
|
||||
auto pads_end = opset10::Constant::create(element::i64, Shape{4}, {0, 0, 0, -1});
|
||||
auto value = opset10::Constant::create(element::f32, Shape{}, {0});
|
||||
auto pad = std::make_shared<ov::op::v12::Pad>(data, pads_begin, pads_end, value, op::PadMode::CONSTANT);
|
||||
auto result = std::make_shared<opset10::Result>(pad);
|
||||
model_ref = std::make_shared<Model>(ResultVector{result}, ParameterVector{data});
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(TransformationTestsF, ActivationReverseInfer) {
|
||||
{
|
||||
auto data = std::make_shared<opset10::Parameter>(element::dynamic, PartialShape::dynamic());
|
||||
|
||||
Reference in new issue
Block a user