Skip to content

Commit

Permalink
Add test cases for GPU and TEMPLATE plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
riverlijunjie committed Jan 10, 2024
1 parent 5b3e882 commit 1c0abcc
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,11 @@ INSTANTIATE_TEST_SUITE_P(smoke_PrePostProcess_GPU,
::testing::Values(ov::test::utils::DEVICE_GPU)),
PrePostProcessTest::getTestCaseName);

INSTANTIATE_TEST_SUITE_P(
smoke_PostProcess,
PostProcessTest,
::testing::Combine(::testing::ValuesIn(ov::builder::preprocess::generic_postprocess_functions()),
::testing::Values(ov::test::utils::DEVICE_GPU)),
PostProcessTest::getTestCaseName);

} // namespace
Original file line number Diff line number Diff line change
Expand Up @@ -1159,6 +1159,38 @@ static RefPreprocessParams post_convert_layout_by_dims_multi() {
return res;
}

static RefPreprocessParams post_convert_color_rgb_to_bgr() {
RefPreprocessParams res("post_convert_color_rgb_to_bgr");
res.function = []() {
auto f = create_simple_function(element::f32, Shape{2, 1, 1, 3});
auto p = PrePostProcessor(f);
p.output().model().set_layout("NHWC").set_color_format(ColorFormat::RGB);
p.output().postprocess().convert_color(ColorFormat::BGR);
p.build();
return f;
};

res.inputs.emplace_back(Shape{2, 3, 1, 1}, element::f32, std::vector<float>{1, 2, 3, 4, 5, 6});
res.expected.emplace_back(Shape{2, 3, 1, 1}, element::f32, std::vector<float>{3, 2, 1, 6, 5, 4});
return res;
}

static RefPreprocessParams post_convert_color_bgr_to_rgb() {
RefPreprocessParams res("post_convert_color_bgr_to_rgb");
res.function = []() {
auto f = create_simple_function(element::f32, Shape{2, 1, 1, 3});
auto p = PrePostProcessor(f);
p.output().model().set_layout("NHWC").set_color_format(ColorFormat::BGR);
p.output().postprocess().convert_color(ColorFormat::RGB);
p.build();
return f;
};

res.inputs.emplace_back(Shape{2, 3, 1, 1}, element::f32, std::vector<float>{1, 2, 3, 4, 5, 6});
res.expected.emplace_back(Shape{2, 3, 1, 1}, element::f32, std::vector<float>{3, 2, 1, 6, 5, 4});
return res;
}

static RefPreprocessParams pre_and_post_processing() {
RefPreprocessParams res("pre_and_post_processing");
res.function = []() {
Expand Down Expand Up @@ -1382,6 +1414,8 @@ std::vector<RefPreprocessParams> allPreprocessTests() {
postprocess_2_inputs_basic(),
post_convert_layout_by_dims(),
post_convert_layout_by_dims_multi(),
post_convert_color_rgb_to_bgr(),
post_convert_color_bgr_to_rgb(),
pre_and_post_processing(),
rgb_to_bgr(),
bgr_to_rgb(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -501,8 +501,8 @@ inline std::shared_ptr<Model> cvt_color_bgr_to_rgb() {

inline std::vector<postprocess_func> generic_postprocess_functions() {
return std::vector<postprocess_func>{
postprocess_func(cvt_color_rgb_to_bgr, "convert_color_rgb_to_bgr", 0.01f),
postprocess_func(cvt_color_bgr_to_rgb, "convert_color_bgr_to_rgb", 0.01f),
postprocess_func(cvt_color_rgb_to_bgr, "convert_color_rgb_to_bgr", 1e-5f),
postprocess_func(cvt_color_bgr_to_rgb, "convert_color_bgr_to_rgb", 1e-5f),
};
}

Expand Down

0 comments on commit 1c0abcc

Please sign in to comment.