Skip to content

Commit

Permalink
Add test without Parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
maxnick committed Nov 9, 2023
1 parent 87e8029 commit 4f0b3de
Showing 1 changed file with 35 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class StaticShapeStatefulModel : public StatefulModelTest {
// For each such a pair, its own variable object must be created.
const std::string variable_name("variable0");
auto variable = std::make_shared<ov::op::util::Variable>(
ov::op::util::VariableInfo{ov::PartialShape::dynamic(), ov::element::dynamic, variable_name});
ov::op::util::VariableInfo{inpShape, netPrc, variable_name});

// Creating ov::Model
auto read = std::make_shared<ov::op::v6::ReadValue>(init_const, variable);
Expand Down Expand Up @@ -183,10 +183,10 @@ class StaticShapeTwoStatesModel : public StatefulModelTest {
// The ReadValue/Assign operations must be used in pairs in the model.
// For each such a pair, its own variable object must be created.
auto variable0 = std::make_shared<ov::op::util::Variable>(
ov::op::util::VariableInfo{ov::PartialShape::dynamic(), ov::element::dynamic, "variable0"});
ov::op::util::VariableInfo{inpShape, netPrc, "variable0"});

auto variable1 = std::make_shared<ov::op::util::Variable>(
ov::op::util::VariableInfo{ov::PartialShape::dynamic(), ov::element::dynamic, "variable1"});
ov::op::util::VariableInfo{inpShape, netPrc, "variable1"});

// Creating ov::Model
auto read0 = std::make_shared<ov::op::v6::ReadValue>(init_const, variable0);
Expand Down Expand Up @@ -263,8 +263,8 @@ TEST_F(StaticShapeTwoStatesModel, smoke_Run_Static_Two_States) {
run_test();
}

// ┌─────────┐ ┌───────────┐
// │ Param1 │---> ReadValue │..
// ┌─────────┐Vary┌───────────┐
// │ Param1 │--->| ReadValue │..
// └───┬──┬──┘ └─────┬─────┘ .
// │ │ │ .
// │ │ │ .
Expand All @@ -283,7 +283,7 @@ TEST_F(StaticShapeTwoStatesModel, smoke_Run_Static_Two_States) {

class DynamicShapeStatefulModel : public StatefulModelTest {
public:
void SetUp() override {
void SetUp(bool use_param) {
targetDevice = ov::test::utils::DEVICE_CPU;
ov::element::Type netPrc = testPrc;

Expand All @@ -297,10 +297,12 @@ class DynamicShapeStatefulModel : public StatefulModelTest {
// For each such a pair, its own variable object must be created.
const std::string variable_name("variable0");
auto variable = std::make_shared<ov::op::util::Variable>(
ov::op::util::VariableInfo{ov::PartialShape::dynamic(), ov::element::dynamic, variable_name});
ov::op::util::VariableInfo{inputDynamicShapes.front(), netPrc, variable_name});

// Creating ov::Model
auto read = std::make_shared<ov::op::v6::ReadValue>(arg, variable);
auto read = use_param ?
std::make_shared<ov::op::v6::ReadValue>(arg, variable) :
std::make_shared<ov::op::v6::ReadValue>(variable);
std::vector<std::shared_ptr<ov::Node>> args = {arg, read};
auto add = ngraph::builder::makeEltwise(arg, read, ngraph::helpers::EltwiseTypes::ADD);
constexpr int concat_axis = 0;
Expand Down Expand Up @@ -376,7 +378,30 @@ class DynamicShapeStatefulModel : public StatefulModelTest {
}
};

TEST_F(DynamicShapeStatefulModel, smoke_Run_Stateful_Dynamic) {
class DynamicShapeStatefulModelDefault : public DynamicShapeStatefulModel {
public:
void SetUp() override {
constexpr bool use_param = false;
DynamicShapeStatefulModel::SetUp(use_param);
}
};

TEST_F(DynamicShapeStatefulModelDefault, smoke_Run_Stateful_Dynamic_Default) {
prepare();
run_test();
reset_state();
run_test();
}

class DynamicShapeStatefulModelParam : public DynamicShapeStatefulModel {
public:
void SetUp() override {
constexpr bool use_param = true;
DynamicShapeStatefulModel::SetUp(use_param);
}
};

TEST_F(DynamicShapeStatefulModelParam, smoke_Run_Stateful_Dynamic_Param) {
prepare();
run_test();
reset_state();
Expand Down Expand Up @@ -430,7 +455,7 @@ class DynamicShapeStatefulModelStateAsInp : public StatefulModelTest {
// For each such a pair, its own variable object must be created.
const std::string variable_name("variable0");
auto variable = std::make_shared<ov::op::util::Variable>(
ov::op::util::VariableInfo{ov::PartialShape::dynamic(), ov::element::dynamic, variable_name});
ov::op::util::VariableInfo{{-1, -1}, netPrc, variable_name});

// Creating ov::Model
auto read = std::make_shared<ov::op::v6::ReadValue>(init_param, variable);
Expand Down

0 comments on commit 4f0b3de

Please sign in to comment.