Skip to content

Commit

Permalink
Leftover: Added tests for fix for PR #8546 (#9313)
Browse files Browse the repository at this point in the history
Added more preprocessing unit tests for fix of PR #8546
Testing: revert changes for the fix. Verify that new tests are failed
  • Loading branch information
nosovmik authored Dec 20, 2021
1 parent 29eb83d commit b7ffbe5
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/core/tests/preprocess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1285,6 +1285,39 @@ TEST(pre_post_process, postprocess_convert_layout_invalid_dims_dyn_shape) {
p.build(), ov::AssertFailure);
}

TEST(pre_post_process, postprocess_keep_friendly_names_compatibility) {
auto f = create_simple_function(element::f32, Shape{1, 3, 10, 10});
auto result_fr_name = f->get_results()[0]->get_friendly_name();
auto node_before_result_old = f->get_results()[0]->get_input_source_output(0).get_node_shared_ptr();
auto node_name = node_before_result_old->get_friendly_name();
auto p = PrePostProcessor(f);
p.output().postprocess().convert_element_type(element::u8);
f = p.build();
EXPECT_EQ(f->get_results()[0]->get_friendly_name(), result_fr_name);
auto node_before_result_new = f->get_results()[0]->get_input_source_output(0).get_node_shared_ptr();
// Compatibility check: verify that old name is assigned to new 'output' node
EXPECT_EQ(node_before_result_new->get_friendly_name(), node_name);
// Compatibility check: Verify that old name is not set for old 'output' node anymore
EXPECT_NE(node_before_result_old->get_friendly_name(), node_name);
}

TEST(pre_post_process, postprocess_keep_friendly_names_compatibility_implicit) {
auto f = create_simple_function(element::f32, Shape{1, 3, 10, 10});
auto result_fr_name = f->get_results()[0]->get_friendly_name();
auto node_before_result_old = f->get_results()[0]->get_input_source_output(0).get_node_shared_ptr();
auto node_name = node_before_result_old->get_friendly_name();
auto p = PrePostProcessor(f);
p.output().model().set_layout("NCHW");
p.output().tensor().set_layout("NHWC");
f = p.build();
EXPECT_EQ(f->get_results()[0]->get_friendly_name(), result_fr_name);
auto node_before_result_new = f->get_results()[0]->get_input_source_output(0).get_node_shared_ptr();
// Compatibility check: verify that old name is assigned to new 'output' node
EXPECT_EQ(node_before_result_new->get_friendly_name(), node_name);
// Compatibility check: Verify that old name is not set for old 'output' node anymore
EXPECT_NE(node_before_result_old->get_friendly_name(), node_name);
}

// Postprocessing - other

TEST(pre_post_process, postprocess_preserve_rt_info) {
Expand Down

0 comments on commit b7ffbe5

Please sign in to comment.