Support dynamic shapes in ReadValue/Assign ops and MakeStateful transformation (#20404)

* Support for dynamic shapes in ReadValue/Assign ops and MakeStateful transformation

* fix unit tests

* codestyle

* fix warning

* fix visitors test

* Fix lowLatency transformation, fix functional tests

* fix LowLatency2

* codestyle

* Fix CPU/GNA tests

* fix shape inference of assign operation

* fix python API

* fix mypy error

* Fix read_value operation version in python API for opsets7-13

* Update python API and fix tests

* set the same Varibable obj to Assign/ReadValue in py API, disable fp16 memory tests

* Update shape inference methods of Assign, ReadValue; update tests; fix codestyle

* fix python codestyle

* fix tests

* Resolve review comments

* codestyle

* resolve review comments

* codestyle

* Update ReadValue op in kaldi frontend, fix GNA tests

* fix Assign/ReadValue bindings, fix read_value test

* Apply suggestions from code review

Co-authored-by: cecilia peng <cecilia.peng@intel.com>

* Fix functional tests, add ov::Type support as an argument for read_value py binding

* temporary disable test_query_state_write_buffer fp16 tests

* Fix backward compatibility with the IRs with ReadValue/Assign ops generated via prev versions of OV; fix func tests

* fix python test, support type as str in read_value/assign bindings

* fix model binding

* fix pre-commit tests: variables vector cleanup

* fix integration with cpu changes

* codestyle

* fix warning

* Fix type/shape validation for read_value op

* fix a type_prop test for assign op

---------

Co-authored-by: cecilia peng <cecilia.peng@intel.com>
This commit is contained in:
Ivan Tikhonovandcecilia peng authored and GitHub committed 2023-11-21 20:59:36 +04:00
1 parent eb94c80804
commit a329611349
42 files changed
+618 -136

No files matched your search

@@ -30,7 +30,7 @@ protected:
void MemoryTestGna::CreateCommonFunc() {
ov::ParameterVector param{std::make_shared<ov::op::v0::Parameter>(ngPrc, ov::Shape(inputShape))};
const auto variable_info = VariableInfo{PartialShape::dynamic(), element::dynamic, "v0"};
const auto variable_info = VariableInfo{inputShape, ngPrc, "v0"};
auto variable = std::make_shared<Variable>(variable_info);
auto min55 = ngraph::builder::makeConstant<float>(ngPrc, {}, {-55.001678466796875f});
@@ -736,12 +736,13 @@ TEST_P(InsertCopyLayerMultiParamNFLConcatMemoryTest, CompareWithRefs) {
ngraph::Shape in_shape = {1, 2, 4};
ngraph::Shape shape1 = {1, 1, 2, 4};
ngraph::Shape shape2 = {2, 4};
ngraph::PartialShape allowed_shape = ngraph::PartialShape::dynamic();
size_t axis = 0;
const std::string variable_name("variable_id");
{
auto variable =
std::make_shared<ngraph::Variable>(ov::op::util::VariableInfo{shape2, ngraph::element::i64, variable_name});
auto variable = std::make_shared<ngraph::Variable>(
ov::op::util::VariableInfo{allowed_shape, ngraph::element::i64, variable_name});
auto input = std::make_shared<ngraph::opset8::Parameter>(ngraph::element::i64, in_shape);
auto reshape1 = ov::op::util::reshapeTo(input, shape1);
auto reshape2 = ov::op::util::reshapeTo(input, shape2);
@@ -761,8 +762,8 @@ TEST_P(InsertCopyLayerMultiParamNFLConcatMemoryTest, CompareWithRefs) {
}
{
auto variable =
std::make_shared<ngraph::Variable>(ov::op::util::VariableInfo{shape2, ngraph::element::i64, variable_name});
auto variable = std::make_shared<ngraph::Variable>(
ov::op::util::VariableInfo{allowed_shape, ngraph::element::i64, variable_name});
auto input = std::make_shared<ngraph::opset8::Parameter>(ngraph::element::i64, in_shape);
auto reshape1 = ov::op::util::reshapeTo(input, shape1);
auto reshape2 = ov::op::util::reshapeTo(input, shape2);
@@ -1107,6 +1108,7 @@ TEST_P(InsertCopyLayerConcatNFLMemoryTest, CompareWithRefs) {
std::shared_ptr<ngraph::Function> ref_func;
ngraph::Shape shape = {1, 2, 2, 4};
ngraph::Shape in_shape = {1, 2, 4};
ngraph::PartialShape allowed_shape = {};
size_t axis = 0;
const std::string variable_name("variable_id");
@@ -1178,12 +1180,13 @@ TEST_P(InsertCopyLayerSplitMemoryTest, CompareWithRefs) {
std::shared_ptr<ngraph::Function> ref_func;
ngraph::Shape in_shape{10};
ngraph::Shape out_shape{5};
ngraph::PartialShape allowed_shape = {{5, 10}};
size_t axis = 0;
const std::string variable_name("variable_id");
{
auto variable = std::make_shared<ngraph::Variable>(
ov::op::util::VariableInfo{out_shape, ngraph::element::i64, variable_name});
ov::op::util::VariableInfo{allowed_shape, ngraph::element::i64, variable_name});
auto input = std::make_shared<ngraph::opset8::Parameter>(ngraph::element::i64, in_shape);
OPENVINO_SUPPRESS_DEPRECATED_START
auto split = ngraph::builder::makeSplit(input, ngraph::element::i64, 1, axis);
@@ -1203,7 +1206,7 @@ TEST_P(InsertCopyLayerSplitMemoryTest, CompareWithRefs) {
{
auto variable = std::make_shared<ngraph::Variable>(
ov::op::util::VariableInfo{out_shape, ngraph::element::i64, variable_name});
ov::op::util::VariableInfo{allowed_shape, ngraph::element::i64, variable_name});
auto input = std::make_shared<ngraph::opset8::Parameter>(ngraph::element::i64, in_shape);
OPENVINO_SUPPRESS_DEPRECATED_START
auto split = ngraph::builder::makeSplit(input, ngraph::element::i64, 1, axis);
@@ -1250,12 +1253,13 @@ TEST_P(InsertCopyLayerSplitNFLMemoryTest, CompareWithRefs) {
ngraph::Shape in_shape{10};
ngraph::Shape shape{1, 5};
ngraph::Shape out_shape{5};
ngraph::PartialShape allowed_shape = ngraph::PartialShape::dynamic();
size_t axis = 0;
const std::string variable_name("variable_id");
{
auto variable = std::make_shared<ngraph::Variable>(
ov::op::util::VariableInfo{out_shape, ngraph::element::i64, variable_name});
ov::op::util::VariableInfo{allowed_shape, ngraph::element::i64, variable_name});
auto input = std::make_shared<ngraph::opset8::Parameter>(ngraph::element::i64, in_shape);
OPENVINO_SUPPRESS_DEPRECATED_START
auto split = ngraph::builder::makeSplit(input, ngraph::element::i64, 2, axis);
@@ -1276,7 +1280,7 @@ TEST_P(InsertCopyLayerSplitNFLMemoryTest, CompareWithRefs) {
{
auto variable = std::make_shared<ngraph::Variable>(
ov::op::util::VariableInfo{out_shape, ngraph::element::i64, variable_name});
ov::op::util::VariableInfo{allowed_shape, ngraph::element::i64, variable_name});
auto input = std::make_shared<ngraph::opset8::Parameter>(ngraph::element::i64, in_shape);
OPENVINO_SUPPRESS_DEPRECATED_START
auto split = ngraph::builder::makeSplit(input, ngraph::element::i64, 2, axis);