Skip to content

Commit

Permalink
Add fs_b_yx_fsv32 type on top of existing low precision test instead …
Browse files Browse the repository at this point in the history
…of adding new tests
  • Loading branch information
kelvinchoi-intel committed Dec 3, 2024
1 parent 998a1e4 commit b78bef0
Showing 1 changed file with 2 additions and 92 deletions.
94 changes: 2 additions & 92 deletions src/plugins/intel_gpu/tests/unit/test_cases/pooling_gpu_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1517,63 +1517,6 @@ TEST(pooling_forward_gpu, b_fs_yx_fsv4)
} // for (int j = 0; F_array[j]; i++)
}

TEST(pooling_forward_gpu, fs_b_yx_fsv32_int8)
{
auto& engine = get_test_engine();

auto input_prim = engine.allocate_memory({ data_types::f32, format::yxfb, { 2, 32, 1, 2 } });

topology topology;
topology.add(input_layout("input", input_prim->get_layout()));
topology.add(reorder("reorder_input", input_info("input"), layout(data_types::i8, format::fs_b_yx_fsv32, { 2, 32, 1, 2 })));
topology.add(pooling("avg_pooling", input_info("reorder_input"), pooling_mode::average, { 7, 7 }, { 2, 2 }));
topology.add(reorder("reorder_after_pooling", input_info("avg_pooling"), layout(data_types::f32, format::fs_b_yx_fsv32, { 2, 32, 1, 1 })));

network network(engine, topology, get_test_default_config(engine));
set_values(input_prim, { 41.f, 42.f, 43.f, 44.f, 45.f, 46.f, 47.f, 48.f,
11.f, 12.f, 13.f, 14.f, 15.f, 16.f, 17.f, 18.f,
21.f, 22.f, 23.f, 24.f, 25.f, 26.f, 27.f, 28.f,
31.f, 32.f, 33.f, 34.f, 35.f, 36.f, 37.f, 38.f,

31.f, 32.f, 33.f, 34.f, 35.f, 36.f, 37.f, 38.f,
21.f, 22.f, 23.f, 24.f, 25.f, 26.f, 27.f, 28.f,
51.f, 52.f, 53.f, 54.f, 55.f, 56.f, 57.f, 58.f,
11.f, 12.f, 13.f, 14.f, 15.f, 16.f, 17.f, 18.f,

41.f, 42.f, 43.f, 44.f, 45.f, 46.f, 47.f, 48.f,
11.f, 12.f, 13.f, 14.f, 15.f, 16.f, 17.f, 18.f,
21.f, 22.f, 23.f, 24.f, 25.f, 26.f, 27.f, 28.f,
31.f, 32.f, 33.f, 34.f, 35.f, 36.f, 37.f, 38.f,

31.f, 32.f, 33.f, 34.f, 35.f, 36.f, 37.f, 38.f,
21.f, 22.f, 23.f, 24.f, 25.f, 26.f, 27.f, 28.f,
51.f, 52.f, 53.f, 54.f, 55.f, 56.f, 57.f, 58.f,
11.f, 12.f, 13.f, 14.f, 15.f, 16.f, 17.f, 18.f });
network.set_input_data("input", input_prim);

auto outputs = network.execute();
ASSERT_EQ(outputs.size(), size_t(1));
ASSERT_EQ(outputs.begin()->first, "reorder_after_pooling");

auto output_prim = outputs.begin()->second.get_memory();

cldnn::mem_lock<float> output_ptr(output_prim, get_test_stream());

std::vector<float> ref_data = { 41.f, 43.f, 45.f, 47.f, 11.f, 13.f, 15.f, 17.f,
21.f, 23.f, 25.f, 27.f, 31.f, 33.f, 35.f, 37.f,
31.f, 33.f, 35.f, 37.f, 21.f, 23.f, 25.f, 27.f,
51.f, 53.f, 55.f, 57.f, 11.f, 13.f, 15.f, 17.f,

42.f, 44.f, 46.f, 48.f, 12.f, 14.f, 16.f, 18.f,
22.f, 24.f, 26.f, 28.f, 32.f, 34.f, 36.f, 38.f,
32.f, 34.f, 36.f, 38.f, 22.f, 24.f, 26.f, 28.f,
52.f, 54.f, 56.f, 58.f, 12.f, 14.f, 16.f, 18.f };

for (size_t i = 0; i < ref_data.size(); i++) {
ASSERT_EQ(ref_data[i], float(output_ptr[i]));
}
}

TEST(pooling_forward_gpu, fs_b_yx_fsv32_avg_3x3_input_2x2_pool_1x1_stride_2x2_output)
{
auto& engine = get_test_engine();
Expand Down Expand Up @@ -2254,7 +2197,8 @@ INSTANTIATE_TEST_SUITE_P(
format::bfyx,
format::b_fs_yx_fsv4,
format::b_fs_yx_fsv16,
format::b_fs_yx_fsv32)),
format::b_fs_yx_fsv32,
format::fs_b_yx_fsv32)),
testing::internal::DefaultParamName<pooling_random_test_params>);

INSTANTIATE_TEST_SUITE_P(
Expand Down Expand Up @@ -2333,40 +2277,6 @@ class pooling_scale_random_test_base : public pooling_random_test_base<InputT, M
VF<output_t> _shift;
};

using pooling_random_test_int8_uint8 = pooling_random_test;

TEST_P(pooling_random_test_int8_uint8, avg_int8) {
auto test_case = pooling_random_test_base<int8_t, pooling_mode::average>();
ASSERT_NO_FATAL_FAILURE(test_case.run_random(GetParam(), false));
}

TEST_P(pooling_random_test_int8_uint8, max_int8) {
auto test_case = pooling_random_test_base<int8_t, pooling_mode::max>();
ASSERT_NO_FATAL_FAILURE(test_case.run_random(GetParam(), false));
}

TEST_P(pooling_random_test_int8_uint8, avg_uint8) {
auto test_case = pooling_random_test_base<uint8_t, pooling_mode::average>();
ASSERT_NO_FATAL_FAILURE(test_case.run_random(GetParam(), false));
}

TEST_P(pooling_random_test_int8_uint8, max_uint8) {
auto test_case = pooling_random_test_base<uint8_t, pooling_mode::max>();
ASSERT_NO_FATAL_FAILURE(test_case.run_random(GetParam(), false));
}

INSTANTIATE_TEST_SUITE_P(
smoke_low_precision,
pooling_random_test_int8_uint8,
testing::Combine(testing::Values(1, 2),
testing::Values(3, 8),
testing::Values(std::tuple<size_t, size_t, size_t>(12, 12, 1), std::tuple<size_t, size_t, size_t>(24, 24, 1)),
testing::Values(std::tuple<size_t, size_t, size_t>(4, 4, 1), std::tuple<size_t, size_t, size_t>(2, 2, 1)),
testing::Values(std::tuple<int, int, int>(2, 2, 1)),
testing::Values(std::tuple<int, int, int>(0, 0, 0)),
testing::Values(format::fs_b_yx_fsv32)),
testing::internal::DefaultParamName<pooling_random_test_params>);

using pooling_random_test_fp16_fp32 = pooling_random_test;

TEST_P(pooling_random_test_fp16_fp32, avg_fp16) {
Expand Down

0 comments on commit b78bef0

Please sign in to comment.