Migrated nGraph tests to common gtest (#6314)

This commit is contained in:
Ilya Churaev
2021-06-24 02:52:04 +03:00
committed by GitHub
parent 91331b55a2
commit 10af23a90c
72 changed files with 802 additions and 957 deletions

View File

@@ -328,14 +328,6 @@ endif()
add_subdirectory(frontend)
if(NGRAPH_UNIT_TEST_ENABLE)
set(BEFORE_GTEST_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
set(BUILD_SHARED_LIBS OFF)
include(cmake/external_gtest.cmake)
set(BUILD_SHARED_LIBS ${BEFORE_GTEST_BUILD_SHARED_LIBS})
unset(BEFORE_GTEST_BUILD_SHARED_LIBS)
endif()
add_subdirectory(test)
if (NGRAPH_PYTHON_BUILD_ENABLE)

View File

@@ -1,78 +0,0 @@
# Copyright (C) 2018-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
# Enable ExternalProject CMake module
include(ExternalProject)
#------------------------------------------------------------------------------
# Download and install GoogleTest ...
#------------------------------------------------------------------------------
SET(GTEST_GIT_REPO_URL https://github.com/google/googletest.git)
SET(GTEST_GIT_LABEL release-1.8.1)
set(GMOCK_OUTPUT_DIR ${EXTERNAL_PROJECTS_ROOT}/gtest/build/googlemock)
set(GTEST_OUTPUT_DIR ${GMOCK_OUTPUT_DIR}/gtest)
if(WIN32)
list(APPEND GTEST_CMAKE_ARGS
-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE=${GTEST_OUTPUT_DIR}
-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELWITHDEBINFO=${GTEST_OUTPUT_DIR}
-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG=${GTEST_OUTPUT_DIR}
-Dgtest_force_shared_crt=TRUE
)
set(GMOCK_OUTPUT_DIR ${GTEST_OUTPUT_DIR})
endif()
if(CMAKE_BUILD_TYPE)
list(APPEND GTEST_CMAKE_ARGS
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
)
endif()
# Build for ninja
SET(GTEST_PATHS ${GTEST_OUTPUT_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gtestd${CMAKE_STATIC_LIBRARY_SUFFIX}
${GMOCK_OUTPUT_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gmockd${CMAKE_STATIC_LIBRARY_SUFFIX}
${GTEST_OUTPUT_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX}
${GMOCK_OUTPUT_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gmock${CMAKE_STATIC_LIBRARY_SUFFIX})
ExternalProject_Add(
ext_gtest
PREFIX gtest
GIT_REPOSITORY ${GTEST_GIT_REPO_URL}
GIT_TAG ${GTEST_GIT_LABEL}
# Disable install step
INSTALL_COMMAND ""
UPDATE_COMMAND ""
CMAKE_GENERATOR ${CMAKE_GENERATOR}
CMAKE_GENERATOR_PLATFORM ${CMAKE_GENERATOR_PLATFORM}
CMAKE_GENERATOR_TOOLSET ${CMAKE_GENERATOR_TOOLSET}
CMAKE_ARGS
${NGRAPH_FORWARD_CMAKE_ARGS}
-DCMAKE_CXX_FLAGS=${GTEST_CXX_FLAGS}
${GTEST_CMAKE_ARGS}
BINARY_DIR "${EXTERNAL_PROJECTS_ROOT}/gtest/build"
EXCLUDE_FROM_ALL TRUE
BUILD_BYPRODUCTS ${GTEST_PATHS}
)
#------------------------------------------------------------------------------
ExternalProject_Get_Property(ext_gtest SOURCE_DIR BINARY_DIR)
add_library(libgtest INTERFACE)
add_dependencies(libgtest ext_gtest ext_gmock)
target_include_directories(libgtest SYSTEM INTERFACE
${SOURCE_DIR}/googletest/include
${SOURCE_DIR}/googlemock/include)
if(LINUX OR APPLE OR WIN32)
target_link_libraries(libgtest INTERFACE
debug ${GTEST_OUTPUT_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gtestd${CMAKE_STATIC_LIBRARY_SUFFIX}
debug ${GMOCK_OUTPUT_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gmockd${CMAKE_STATIC_LIBRARY_SUFFIX}
optimized ${GTEST_OUTPUT_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX}
optimized ${GMOCK_OUTPUT_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gmock${CMAKE_STATIC_LIBRARY_SUFFIX})
else()
message(FATAL_ERROR "libgtest: Unsupported platform.")
endif()

View File

@@ -18,14 +18,6 @@ if(LINUX)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "4.0.0")
# gtest has issues with this with v1.8.x
# gtest issue is supposed to be addressed after v1.8.x
add_compile_options(-Wno-zero-as-null-pointer-constant)
endif()
endif()
set(SRC
aligned_buffer.cpp
all_close_f.cpp

View File

@@ -158,23 +158,23 @@ TEST_P(all_close_f_param_test, test_boundaries)
<< ss.str();
}
INSTANTIATE_TEST_CASE_P(test_simple_floats_with_range_of_precisions,
all_close_f_param_test,
testing::Combine(testing::Values(0.f,
-0.f,
1.f,
-1.f,
10.f,
-10.f,
0.75f,
-0.75f,
0.5f,
-0.5f,
0.25f,
-0.25f,
0.125f,
-0.125f),
testing::Range(0, 5)), );
INSTANTIATE_TEST_SUITE_P(test_simple_floats_with_range_of_precisions,
all_close_f_param_test,
testing::Combine(testing::Values(0.f,
-0.f,
1.f,
-1.f,
10.f,
-10.f,
0.75f,
-0.75f,
0.5f,
-0.5f,
0.25f,
-0.25f,
0.125f,
-0.125f),
testing::Range(0, 5)));
class all_close_f_double_param_test : public testing::TestWithParam<::std::tuple<double, int>>
{
@@ -315,13 +315,13 @@ TEST_P(all_close_f_double_param_test, test_boundaries)
<< ss.str();
}
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
test_simple_doubles_with_range_of_precisions,
all_close_f_double_param_test,
testing::Combine(
testing::Values(
0., -0., 1., -1., 10., -10., 0.75, -0.75, 0.5, -0.5, 0.25, -0.25, 0.125, -0.125),
testing::Range(0, 17)), );
testing::Range(0, 17)));
// Test the exact bounds near +0.f
//

View File

@@ -185,10 +185,10 @@ NGRAPH_TEST_P(${BACKEND_NAME}, concat_vector_params, concat_vector_large)
// Add thhosw tests to cover paramter space overflow:
// cuda kernel parameter space have limit, if there is large number of parameters,
// there will be overflow for parameter space.
NGRAPH_INSTANTIATE_TEST_CASE_P(${BACKEND_NAME},
input_sizes,
concat_vector_params,
testing::Values(100, 128, 999));
NGRAPH_INSTANTIATE_TEST_SUITE_P(${BACKEND_NAME},
input_sizes,
concat_vector_params,
testing::Values(100, 128, 999));
NGRAPH_TEST(${BACKEND_NAME}, concat_vector)
{

View File

@@ -110,14 +110,14 @@ namespace
MIN_FLOAT_TOLERANCE_BITS));
}
};
}
} // namespace
NGRAPH_TEST_P(${BACKEND_NAME}, PadBackendTest, PadBackendTestForSpec)
{
execute_test(GetParam());
}
NGRAPH_INSTANTIATE_TEST_CASE_P(
NGRAPH_INSTANTIATE_TEST_SUITE_P(
${BACKEND_NAME},
pad_1d_constant_const_value_provided,
PadBackendTest,
@@ -142,7 +142,7 @@ NGRAPH_INSTANTIATE_TEST_CASE_P(
op::PadMode::CONSTANT,
2112}));
NGRAPH_INSTANTIATE_TEST_CASE_P(
NGRAPH_INSTANTIATE_TEST_SUITE_P(
${BACKEND_NAME},
pad_1d_constant_use_default_const,
PadBackendTest,
@@ -163,7 +163,7 @@ NGRAPH_INSTANTIATE_TEST_CASE_P(
test::NDArray<float, 1>({1, 2, 3, 4, 5, 6, 0, 0, 0}),
op::PadMode::CONSTANT}));
NGRAPH_INSTANTIATE_TEST_CASE_P(
NGRAPH_INSTANTIATE_TEST_SUITE_P(
${BACKEND_NAME},
pad_2d_constant_const_value_provided,
PadBackendTest,
@@ -210,50 +210,50 @@ NGRAPH_INSTANTIATE_TEST_CASE_P(
op::PadMode::CONSTANT,
2112}));
NGRAPH_INSTANTIATE_TEST_CASE_P(${BACKEND_NAME},
pad_2d_constant_use_default_const,
PadBackendTest,
testing::Values(Params<float>{test::NDArray<float, 2>({
{1, 2},
{3, 4},
}),
test::NDArray<int64_t, 1>({1, 2}),
test::NDArray<int64_t, 1>({3, 4}),
test::NDArray<float, 2>({
{0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 1, 2, 0, 0, 0, 0},
{0, 0, 3, 4, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0},
}),
op::PadMode::CONSTANT},
Params<float>{test::NDArray<float, 2>({
{1, 2},
{3, 4},
}),
test::NDArray<int64_t, 1>({1, 2}),
test::NDArray<int64_t, 1>({0, 0}),
test::NDArray<float, 2>({
{0, 0, 0, 0},
{0, 0, 1, 2},
{0, 0, 3, 4},
}),
op::PadMode::CONSTANT},
Params<float>{test::NDArray<float, 2>({
{1, 2},
{3, 4},
}),
test::NDArray<int64_t, 1>({0, 0}),
test::NDArray<int64_t, 1>({1, 2}),
test::NDArray<float, 2>({
{1, 2, 0, 0},
{3, 4, 0, 0},
{0, 0, 0, 0},
}),
op::PadMode::CONSTANT}));
NGRAPH_INSTANTIATE_TEST_SUITE_P(${BACKEND_NAME},
pad_2d_constant_use_default_const,
PadBackendTest,
testing::Values(Params<float>{test::NDArray<float, 2>({
{1, 2},
{3, 4},
}),
test::NDArray<int64_t, 1>({1, 2}),
test::NDArray<int64_t, 1>({3, 4}),
test::NDArray<float, 2>({
{0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 1, 2, 0, 0, 0, 0},
{0, 0, 3, 4, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0},
}),
op::PadMode::CONSTANT},
Params<float>{test::NDArray<float, 2>({
{1, 2},
{3, 4},
}),
test::NDArray<int64_t, 1>({1, 2}),
test::NDArray<int64_t, 1>({0, 0}),
test::NDArray<float, 2>({
{0, 0, 0, 0},
{0, 0, 1, 2},
{0, 0, 3, 4},
}),
op::PadMode::CONSTANT},
Params<float>{test::NDArray<float, 2>({
{1, 2},
{3, 4},
}),
test::NDArray<int64_t, 1>({0, 0}),
test::NDArray<int64_t, 1>({1, 2}),
test::NDArray<float, 2>({
{1, 2, 0, 0},
{3, 4, 0, 0},
{0, 0, 0, 0},
}),
op::PadMode::CONSTANT}));
NGRAPH_INSTANTIATE_TEST_CASE_P(
NGRAPH_INSTANTIATE_TEST_SUITE_P(
${BACKEND_NAME},
pad_1d_edge,
PadBackendTest,
@@ -273,50 +273,50 @@ NGRAPH_INSTANTIATE_TEST_CASE_P(
test::NDArray<float, 1>({1, 2, 3, 4, 5, 6, 6, 6}),
op::PadMode::EDGE}));
NGRAPH_INSTANTIATE_TEST_CASE_P(${BACKEND_NAME},
pad_2d_edge,
PadBackendTest,
testing::Values(Params<float>{test::NDArray<float, 2>({
{1, 2},
{3, 4},
}),
test::NDArray<int64_t, 1>({1, 2}),
test::NDArray<int64_t, 1>({2, 1}),
test::NDArray<float, 2>({
{1, 1, 1, 2, 2},
{1, 1, 1, 2, 2},
{3, 3, 3, 4, 4},
{3, 3, 3, 4, 4},
{3, 3, 3, 4, 4},
}),
op::PadMode::EDGE},
Params<float>{test::NDArray<float, 2>({
{1, 2},
{3, 4},
}),
test::NDArray<int64_t, 1>({1, 2}),
test::NDArray<int64_t, 1>({0, 0}),
test::NDArray<float, 2>({
{1, 1, 1, 2},
{1, 1, 1, 2},
{3, 3, 3, 4},
}),
op::PadMode::EDGE},
Params<float>{test::NDArray<float, 2>({
{1, 2},
{3, 4},
}),
test::NDArray<int64_t, 1>({0, 0}),
test::NDArray<int64_t, 1>({2, 1}),
test::NDArray<float, 2>({
{1, 2, 2},
{3, 4, 4},
{3, 4, 4},
{3, 4, 4},
}),
op::PadMode::EDGE}));
NGRAPH_INSTANTIATE_TEST_SUITE_P(${BACKEND_NAME},
pad_2d_edge,
PadBackendTest,
testing::Values(Params<float>{test::NDArray<float, 2>({
{1, 2},
{3, 4},
}),
test::NDArray<int64_t, 1>({1, 2}),
test::NDArray<int64_t, 1>({2, 1}),
test::NDArray<float, 2>({
{1, 1, 1, 2, 2},
{1, 1, 1, 2, 2},
{3, 3, 3, 4, 4},
{3, 3, 3, 4, 4},
{3, 3, 3, 4, 4},
}),
op::PadMode::EDGE},
Params<float>{test::NDArray<float, 2>({
{1, 2},
{3, 4},
}),
test::NDArray<int64_t, 1>({1, 2}),
test::NDArray<int64_t, 1>({0, 0}),
test::NDArray<float, 2>({
{1, 1, 1, 2},
{1, 1, 1, 2},
{3, 3, 3, 4},
}),
op::PadMode::EDGE},
Params<float>{test::NDArray<float, 2>({
{1, 2},
{3, 4},
}),
test::NDArray<int64_t, 1>({0, 0}),
test::NDArray<int64_t, 1>({2, 1}),
test::NDArray<float, 2>({
{1, 2, 2},
{3, 4, 4},
{3, 4, 4},
{3, 4, 4},
}),
op::PadMode::EDGE}));
NGRAPH_INSTANTIATE_TEST_CASE_P(
NGRAPH_INSTANTIATE_TEST_SUITE_P(
${BACKEND_NAME},
pad_1d_reflect,
PadBackendTest,
@@ -336,56 +336,56 @@ NGRAPH_INSTANTIATE_TEST_CASE_P(
test::NDArray<float, 1>({1, 2, 3, 4, 5, 6, 5, 4}),
op::PadMode::REFLECT}));
NGRAPH_INSTANTIATE_TEST_CASE_P(${BACKEND_NAME},
pad_2d_reflect,
PadBackendTest,
testing::Values(Params<float>{test::NDArray<float, 2>({
{1, 2, 3},
{4, 5, 6},
{7, 8, 9},
}),
test::NDArray<int64_t, 1>({1, 2}),
test::NDArray<int64_t, 1>({2, 1}),
test::NDArray<float, 2>({
{6, 5, 4, 5, 6, 5},
{3, 2, 1, 2, 3, 2},
{6, 5, 4, 5, 6, 5},
{9, 8, 7, 8, 9, 8},
{6, 5, 4, 5, 6, 5},
{3, 2, 1, 2, 3, 2},
}),
op::PadMode::REFLECT},
Params<float>{test::NDArray<float, 2>({
{1, 2, 3},
{4, 5, 6},
{7, 8, 9},
}),
test::NDArray<int64_t, 1>({1, 2}),
test::NDArray<int64_t, 1>({0, 0}),
test::NDArray<float, 2>({
{6, 5, 4, 5, 6},
{3, 2, 1, 2, 3},
{6, 5, 4, 5, 6},
{9, 8, 7, 8, 9},
}),
op::PadMode::REFLECT},
Params<float>{test::NDArray<float, 2>({
{1, 2, 3},
{4, 5, 6},
{7, 8, 9},
}),
test::NDArray<int64_t, 1>({0, 0}),
test::NDArray<int64_t, 1>({2, 1}),
test::NDArray<float, 2>({
{1, 2, 3, 2},
{4, 5, 6, 5},
{7, 8, 9, 8},
{4, 5, 6, 5},
{1, 2, 3, 2},
}),
op::PadMode::REFLECT}));
NGRAPH_INSTANTIATE_TEST_SUITE_P(${BACKEND_NAME},
pad_2d_reflect,
PadBackendTest,
testing::Values(Params<float>{test::NDArray<float, 2>({
{1, 2, 3},
{4, 5, 6},
{7, 8, 9},
}),
test::NDArray<int64_t, 1>({1, 2}),
test::NDArray<int64_t, 1>({2, 1}),
test::NDArray<float, 2>({
{6, 5, 4, 5, 6, 5},
{3, 2, 1, 2, 3, 2},
{6, 5, 4, 5, 6, 5},
{9, 8, 7, 8, 9, 8},
{6, 5, 4, 5, 6, 5},
{3, 2, 1, 2, 3, 2},
}),
op::PadMode::REFLECT},
Params<float>{test::NDArray<float, 2>({
{1, 2, 3},
{4, 5, 6},
{7, 8, 9},
}),
test::NDArray<int64_t, 1>({1, 2}),
test::NDArray<int64_t, 1>({0, 0}),
test::NDArray<float, 2>({
{6, 5, 4, 5, 6},
{3, 2, 1, 2, 3},
{6, 5, 4, 5, 6},
{9, 8, 7, 8, 9},
}),
op::PadMode::REFLECT},
Params<float>{test::NDArray<float, 2>({
{1, 2, 3},
{4, 5, 6},
{7, 8, 9},
}),
test::NDArray<int64_t, 1>({0, 0}),
test::NDArray<int64_t, 1>({2, 1}),
test::NDArray<float, 2>({
{1, 2, 3, 2},
{4, 5, 6, 5},
{7, 8, 9, 8},
{4, 5, 6, 5},
{1, 2, 3, 2},
}),
op::PadMode::REFLECT}));
NGRAPH_INSTANTIATE_TEST_CASE_P(
NGRAPH_INSTANTIATE_TEST_SUITE_P(
${BACKEND_NAME},
pad_1d_symmetric,
PadBackendTest,
@@ -405,55 +405,55 @@ NGRAPH_INSTANTIATE_TEST_CASE_P(
test::NDArray<float, 1>({1, 2, 3, 4, 5, 6, 6, 5}),
op::PadMode::SYMMETRIC}));
NGRAPH_INSTANTIATE_TEST_CASE_P(${BACKEND_NAME},
pad_2d_symmetric,
PadBackendTest,
testing::Values(Params<float>{test::NDArray<float, 2>({
{1, 2, 3},
{4, 5, 6},
{7, 8, 9},
}),
test::NDArray<int64_t, 1>({1, 2}),
test::NDArray<int64_t, 1>({2, 1}),
test::NDArray<float, 2>({
{2, 1, 1, 2, 3, 3},
{2, 1, 1, 2, 3, 3},
{5, 4, 4, 5, 6, 6},
{8, 7, 7, 8, 9, 9},
{8, 7, 7, 8, 9, 9},
{5, 4, 4, 5, 6, 6},
}),
op::PadMode::SYMMETRIC},
Params<float>{test::NDArray<float, 2>({
{1, 2, 3},
{4, 5, 6},
{7, 8, 9},
}),
test::NDArray<int64_t, 1>({1, 2}),
test::NDArray<int64_t, 1>({0, 0}),
test::NDArray<float, 2>({
{2, 1, 1, 2, 3},
{2, 1, 1, 2, 3},
{5, 4, 4, 5, 6},
{8, 7, 7, 8, 9},
NGRAPH_INSTANTIATE_TEST_SUITE_P(${BACKEND_NAME},
pad_2d_symmetric,
PadBackendTest,
testing::Values(Params<float>{test::NDArray<float, 2>({
{1, 2, 3},
{4, 5, 6},
{7, 8, 9},
}),
test::NDArray<int64_t, 1>({1, 2}),
test::NDArray<int64_t, 1>({2, 1}),
test::NDArray<float, 2>({
{2, 1, 1, 2, 3, 3},
{2, 1, 1, 2, 3, 3},
{5, 4, 4, 5, 6, 6},
{8, 7, 7, 8, 9, 9},
{8, 7, 7, 8, 9, 9},
{5, 4, 4, 5, 6, 6},
}),
op::PadMode::SYMMETRIC},
Params<float>{test::NDArray<float, 2>({
{1, 2, 3},
{4, 5, 6},
{7, 8, 9},
}),
test::NDArray<int64_t, 1>({1, 2}),
test::NDArray<int64_t, 1>({0, 0}),
test::NDArray<float, 2>({
{2, 1, 1, 2, 3},
{2, 1, 1, 2, 3},
{5, 4, 4, 5, 6},
{8, 7, 7, 8, 9},
}),
op::PadMode::SYMMETRIC},
Params<float>{test::NDArray<float, 2>({
{1, 2, 3},
{4, 5, 6},
{7, 8, 9},
}),
test::NDArray<int64_t, 1>({0, 0}),
test::NDArray<int64_t, 1>({2, 1}),
test::NDArray<float, 2>({
{1, 2, 3, 3},
{4, 5, 6, 6},
{7, 8, 9, 9},
{7, 8, 9, 9},
{4, 5, 6, 6},
}),
op::PadMode::SYMMETRIC}));
}),
op::PadMode::SYMMETRIC},
Params<float>{test::NDArray<float, 2>({
{1, 2, 3},
{4, 5, 6},
{7, 8, 9},
}),
test::NDArray<int64_t, 1>({0, 0}),
test::NDArray<int64_t, 1>({2, 1}),
test::NDArray<float, 2>({
{1, 2, 3, 3},
{4, 5, 6, 6},
{7, 8, 9, 9},
{7, 8, 9, 9},
{4, 5, 6, 6},
}),
op::PadMode::SYMMETRIC}));
NGRAPH_TEST(${BACKEND_NAME}, pad_to_large_symmetric_padding)
{

View File

@@ -1261,7 +1261,7 @@ template <typename T>
class topk_backend : public ::testing::Test
{
};
TYPED_TEST_CASE_P(topk_backend);
TYPED_TEST_SUITE_P(topk_backend);
template <typename Mode, typename SortType>
struct TopkSortTestOutputs
@@ -1323,7 +1323,7 @@ TYPED_TEST_P(topk_backend, topk_mode_sort_order)
}
}
REGISTER_TYPED_TEST_CASE_P(topk_backend, topk_mode_sort_order);
REGISTER_TYPED_TEST_SUITE_P(topk_backend, topk_mode_sort_order);
typedef ::testing::Types<op::v1::TopK, op::v3::TopK> TopKTypes;
INSTANTIATE_TYPED_TEST_CASE_P(${BACKEND_NAME}, topk_backend, TopKTypes);
INSTANTIATE_TYPED_TEST_SUITE_P(${BACKEND_NAME}, topk_backend, TopKTypes);

View File

@@ -29,7 +29,7 @@ template <typename T>
class ElemTypesTests : public ::testing::Test
{
};
TYPED_TEST_CASE_P(ElemTypesTests);
TYPED_TEST_SUITE_P(ElemTypesTests);
TYPED_TEST_P(ElemTypesTests, onnx_test_add_abc_set_precission)
{
@@ -69,14 +69,14 @@ TYPED_TEST_P(ElemTypesTests, onnx_test_split_multioutput_set_precission)
test_case.run();
}
REGISTER_TYPED_TEST_CASE_P(ElemTypesTests,
onnx_test_add_abc_set_precission,
onnx_test_split_multioutput_set_precission);
REGISTER_TYPED_TEST_SUITE_P(ElemTypesTests,
onnx_test_add_abc_set_precission,
onnx_test_split_multioutput_set_precission);
typedef ::testing::Types<int8_t, int16_t, int32_t, uint8_t, float> ElemTypes;
INSTANTIATE_TYPED_TEST_CASE_P(${BACKEND_NAME}, ElemTypesTests, ElemTypes);
INSTANTIATE_TYPED_TEST_SUITE_P(${BACKEND_NAME}, ElemTypesTests, ElemTypes);
NGRAPH_TEST(${BACKEND_NAME}, add_abc_from_ir) {
NGRAPH_TEST(${BACKEND_NAME}, add_abc_from_ir)
{
const auto ir_xml = file_util::path_join(SERIALIZED_ZOO, "ir/add_abc.xml");
const auto function = test::function_from_ir(ir_xml);
@@ -89,7 +89,8 @@ NGRAPH_TEST(${BACKEND_NAME}, add_abc_from_ir) {
test_case.run();
}
NGRAPH_TEST(${BACKEND_NAME}, add_abc_from_ir_with_bin_path) {
NGRAPH_TEST(${BACKEND_NAME}, add_abc_from_ir_with_bin_path)
{
const auto ir_xml = file_util::path_join(SERIALIZED_ZOO, "ir/add_abc.xml");
const auto ir_bin = file_util::path_join(SERIALIZED_ZOO, "ir/weights/add_abc.bin");
const auto function = test::function_from_ir(ir_xml, ir_bin);

View File

@@ -64,169 +64,169 @@ TEST_P(ReshapeOptKernel, reshape_opt_kernel)
EXPECT_EQ(p.output.get_vector(), output_buff);
}
INSTANTIATE_TEST_CASE_P(reshape_opt_kernel,
ReshapeOptKernel,
::testing::Values(TestParams{AxisOrder::straight,
test::NDArray<ElementValue, 2>{
{1, 2},
{3, 4},
{5, 6},
},
test::NDArray<ElementValue, 2>{
{1, 2, 3},
{4, 5, 6},
}},
TestParams{AxisOrder::straight,
test::NDArray<ElementValue, 2>{
{1, 2},
{3, 4},
{5, 6},
},
test::NDArray<ElementValue, 1>{
{1, 2, 3, 4, 5, 6},
}},
TestParams{AxisOrder::straight,
test::NDArray<ElementValue, 3>{
{
{11, 12},
{13, 14},
{15, 16},
},
{
{21, 22},
{23, 24},
{25, 26},
},
},
test::NDArray<ElementValue, 2>{
{11, 12, 13, 14, 15, 16},
{21, 22, 23, 24, 25, 26},
}},
TestParams{AxisOrder::straight,
test::NDArray<ElementValue, 4>{
{
{
{11, 12},
{13, 14},
{15, 16},
},
{
{21, 22},
{23, 24},
{25, 26},
},
},
},
test::NDArray<ElementValue, 2>{
{11, 12, 13, 14, 15, 16},
{21, 22, 23, 24, 25, 26},
}},
TestParams{AxisOrder::reverse,
test::NDArray<ElementValue, 2>{
{1, 2},
{3, 4},
{5, 6},
},
test::NDArray<ElementValue, 2>{
{1, 3, 5},
{2, 4, 6},
}},
TestParams{AxisOrder::reverse,
test::NDArray<ElementValue, 2>{
{1, 2},
{3, 4},
{5, 6},
},
test::NDArray<ElementValue, 1>{
{1, 3, 5, 2, 4, 6},
}},
TestParams{AxisOrder::reverse,
test::NDArray<ElementValue, 3>{
{
{11, 12},
{13, 14},
{15, 16},
},
{
{21, 22},
{23, 24},
{25, 26},
},
},
test::NDArray<ElementValue, 2>{
{11, 21, 13, 23, 15, 25},
{12, 22, 14, 24, 16, 26},
}},
TestParams{AxisOrder::reverse,
test::NDArray<ElementValue, 4>{
{
{
{11, 12},
{13, 14},
{15, 16},
},
{
{21, 22},
{23, 24},
{25, 26},
},
},
},
test::NDArray<ElementValue, 2>{
{11, 21, 13, 23, 15, 25},
{12, 22, 14, 24, 16, 26},
}}));
INSTANTIATE_TEST_SUITE_P(reshape_opt_kernel,
ReshapeOptKernel,
::testing::Values(TestParams{AxisOrder::straight,
test::NDArray<ElementValue, 2>{
{1, 2},
{3, 4},
{5, 6},
},
test::NDArray<ElementValue, 2>{
{1, 2, 3},
{4, 5, 6},
}},
TestParams{AxisOrder::straight,
test::NDArray<ElementValue, 2>{
{1, 2},
{3, 4},
{5, 6},
},
test::NDArray<ElementValue, 1>{
{1, 2, 3, 4, 5, 6},
}},
TestParams{AxisOrder::straight,
test::NDArray<ElementValue, 3>{
{
{11, 12},
{13, 14},
{15, 16},
},
{
{21, 22},
{23, 24},
{25, 26},
},
},
test::NDArray<ElementValue, 2>{
{11, 12, 13, 14, 15, 16},
{21, 22, 23, 24, 25, 26},
}},
TestParams{AxisOrder::straight,
test::NDArray<ElementValue, 4>{
{
{
{11, 12},
{13, 14},
{15, 16},
},
{
{21, 22},
{23, 24},
{25, 26},
},
},
},
test::NDArray<ElementValue, 2>{
{11, 12, 13, 14, 15, 16},
{21, 22, 23, 24, 25, 26},
}},
TestParams{AxisOrder::reverse,
test::NDArray<ElementValue, 2>{
{1, 2},
{3, 4},
{5, 6},
},
test::NDArray<ElementValue, 2>{
{1, 3, 5},
{2, 4, 6},
}},
TestParams{AxisOrder::reverse,
test::NDArray<ElementValue, 2>{
{1, 2},
{3, 4},
{5, 6},
},
test::NDArray<ElementValue, 1>{
{1, 3, 5, 2, 4, 6},
}},
TestParams{AxisOrder::reverse,
test::NDArray<ElementValue, 3>{
{
{11, 12},
{13, 14},
{15, 16},
},
{
{21, 22},
{23, 24},
{25, 26},
},
},
test::NDArray<ElementValue, 2>{
{11, 21, 13, 23, 15, 25},
{12, 22, 14, 24, 16, 26},
}},
TestParams{AxisOrder::reverse,
test::NDArray<ElementValue, 4>{
{
{
{11, 12},
{13, 14},
{15, 16},
},
{
{21, 22},
{23, 24},
{25, 26},
},
},
},
test::NDArray<ElementValue, 2>{
{11, 21, 13, 23, 15, 25},
{12, 22, 14, 24, 16, 26},
}}));
// input shape with size > 6 should be covered by reference implementation:
INSTANTIATE_TEST_CASE_P(reshape_opt_kernel_ref_impl_fallback,
ReshapeOptKernel,
::testing::Values(TestParams{AxisOrder::straight,
test::NDArray<ElementValue, 7>{
{
{
{
{
{
{11, 12},
{13, 14},
{15, 16},
},
{
{21, 22},
{23, 24},
{25, 26},
},
},
},
},
},
},
test::NDArray<ElementValue, 2>{
{11, 12, 13, 14, 15, 16},
{21, 22, 23, 24, 25, 26},
}},
TestParams{AxisOrder::reverse,
test::NDArray<ElementValue, 7>{
{
{
{
{
{
{11, 12},
{13, 14},
{15, 16},
},
{
{21, 22},
{23, 24},
{25, 26},
},
},
},
},
},
},
test::NDArray<ElementValue, 2>{
{11, 21, 13, 23, 15, 25},
{12, 22, 14, 24, 16, 26},
}}));
INSTANTIATE_TEST_SUITE_P(reshape_opt_kernel_ref_impl_fallback,
ReshapeOptKernel,
::testing::Values(TestParams{AxisOrder::straight,
test::NDArray<ElementValue, 7>{
{
{
{
{
{
{11, 12},
{13, 14},
{15, 16},
},
{
{21, 22},
{23, 24},
{25, 26},
},
},
},
},
},
},
test::NDArray<ElementValue, 2>{
{11, 12, 13, 14, 15, 16},
{21, 22, 23, 24, 25, 26},
}},
TestParams{AxisOrder::reverse,
test::NDArray<ElementValue, 7>{
{
{
{
{
{
{11, 12},
{13, 14},
{15, 16},
},
{
{21, 22},
{23, 24},
{25, 26},
},
},
},
},
},
},
test::NDArray<ElementValue, 2>{
{11, 21, 13, 23, 15, 25},
{12, 22, 14, 24, 16, 26},
}}));

View File

@@ -6,4 +6,4 @@
using Type = ::testing::Types<ngraph::op::Abs>;
INSTANTIATE_TYPED_TEST_CASE_P(type_prop_abs, UnaryOperator, Type);
INSTANTIATE_TYPED_TEST_SUITE_P(type_prop_abs, UnaryOperator, Type);

View File

@@ -6,4 +6,4 @@
using Type = ::testing::Types<ngraph::op::Acos>;
INSTANTIATE_TYPED_TEST_CASE_P(type_prop_acos, UnaryOperator, Type);
INSTANTIATE_TYPED_TEST_SUITE_P(type_prop_acos, UnaryOperator, Type);

View File

@@ -24,14 +24,14 @@ class ArithmeticOperator : public testing::Test
{
};
TYPED_TEST_CASE_P(ArithmeticOperator);
TYPED_TEST_SUITE_P(ArithmeticOperator);
TYPED_TEST_P(ArithmeticOperator, shape_inference_2D)
{
auto A = std::make_shared<op::Parameter>(element::f32, Shape{2, 2});
auto B = std::make_shared<op::Parameter>(element::f32, Shape{2, 2});
const auto op = std::make_shared<TypeParam>(A, B);
const auto op = std::make_shared<TypeParam>(A, B);
ASSERT_EQ(op->get_element_type(), element::f32);
ASSERT_EQ(op->get_shape(), (Shape{2, 2}));
@@ -42,7 +42,7 @@ TYPED_TEST_P(ArithmeticOperator, shape_inference_4D)
auto A = std::make_shared<op::Parameter>(element::f32, Shape{2, 2, 3, 3});
auto B = std::make_shared<op::Parameter>(element::f32, Shape{2, 2, 3, 3});
const auto op = std::make_shared<TypeParam>(A, B);
const auto op = std::make_shared<TypeParam>(A, B);
ASSERT_EQ(op->get_element_type(), element::f32);
ASSERT_EQ(op->get_shape(), (Shape{2, 2, 3, 3}));
@@ -53,7 +53,7 @@ TYPED_TEST_P(ArithmeticOperator, default_autobroadcast)
auto A = std::make_shared<op::Parameter>(element::f32, Shape{2, 2});
auto B = std::make_shared<op::Parameter>(element::f32, Shape{2, 2});
const auto op = std::make_shared<TypeParam>(A, B);
const auto op = std::make_shared<TypeParam>(A, B);
ASSERT_EQ(op->get_element_type(), element::f32);
ASSERT_EQ(op->get_shape(), (Shape{2, 2}));
@@ -77,7 +77,7 @@ TYPED_TEST_P(ArithmeticOperator, shape_inference_4D_x_scalar_numpy_broadcast)
auto A = std::make_shared<op::Parameter>(element::f32, Shape{2, 3, 4, 5});
auto B = std::make_shared<op::Parameter>(element::f32, Shape{1});
const auto op = std::make_shared<TypeParam>(A, B);
const auto op = std::make_shared<TypeParam>(A, B);
ASSERT_EQ(op->get_element_type(), element::f32);
ASSERT_EQ(op->get_shape(), (Shape{2, 3, 4, 5}));
@@ -88,7 +88,7 @@ TYPED_TEST_P(ArithmeticOperator, shape_inference_4D_x_1D_numpy_broadcast)
auto A = std::make_shared<op::Parameter>(element::f32, Shape{2, 3, 4, 5});
auto B = std::make_shared<op::Parameter>(element::f32, Shape{5});
const auto op = std::make_shared<TypeParam>(A, B);
const auto op = std::make_shared<TypeParam>(A, B);
ASSERT_EQ(op->get_element_type(), element::f32);
ASSERT_EQ(op->get_shape(), (Shape{2, 3, 4, 5}));
@@ -99,7 +99,7 @@ TYPED_TEST_P(ArithmeticOperator, shape_inference_2D_x_4D_numpy_broadcast)
auto A = std::make_shared<op::Parameter>(element::f32, Shape{4, 5});
auto B = std::make_shared<op::Parameter>(element::f32, Shape{2, 3, 4, 5});
const auto op = std::make_shared<TypeParam>(A, B);
const auto op = std::make_shared<TypeParam>(A, B);
ASSERT_EQ(op->get_element_type(), element::f32);
ASSERT_EQ(op->get_shape(), (Shape{2, 3, 4, 5}));
@@ -110,7 +110,7 @@ TYPED_TEST_P(ArithmeticOperator, shape_inference_3D_x_4D_numpy_broadcast)
auto A = std::make_shared<op::Parameter>(element::f32, Shape{1, 4, 5});
auto B = std::make_shared<op::Parameter>(element::f32, Shape{2, 3, 1, 1});
const auto op = std::make_shared<TypeParam>(A, B);
const auto op = std::make_shared<TypeParam>(A, B);
ASSERT_EQ(op->get_element_type(), element::f32);
ASSERT_EQ(op->get_shape(), (Shape{2, 3, 4, 5}));
@@ -121,7 +121,7 @@ TYPED_TEST_P(ArithmeticOperator, shape_inference_4D_x_3D_numpy_broadcast)
auto A = std::make_shared<op::Parameter>(element::f32, Shape{8, 1, 6, 1});
auto B = std::make_shared<op::Parameter>(element::f32, Shape{7, 1, 5});
const auto op = std::make_shared<TypeParam>(A, B);
const auto op = std::make_shared<TypeParam>(A, B);
ASSERT_EQ(op->get_element_type(), element::f32);
ASSERT_EQ(op->get_shape(), (Shape{8, 7, 6, 5}));
@@ -174,7 +174,7 @@ TYPED_TEST_P(ArithmeticOperator, dynamic_shape_3D)
auto A = std::make_shared<op::Parameter>(element::f32, PartialShape{dynamic, dynamic, 6});
auto B = std::make_shared<op::Parameter>(element::f32, PartialShape{dynamic, dynamic, 6});
const auto op = std::make_shared<TypeParam>(A, B);
const auto op = std::make_shared<TypeParam>(A, B);
ASSERT_EQ(op->get_element_type(), element::f32);
ASSERT_EQ(op->get_output_partial_shape(0), (PartialShape{dynamic, dynamic, 6}));
@@ -183,16 +183,15 @@ TYPED_TEST_P(ArithmeticOperator, dynamic_shape_3D)
TYPED_TEST_P(ArithmeticOperator, dynamic_shape_5D)
{
Dimension dynamic = Dimension::dynamic();
auto A =
std::make_shared<op::Parameter>(element::f32, PartialShape{dynamic, 4, dynamic, dynamic, 6});
auto B =
std::make_shared<op::Parameter>(element::f32, PartialShape{dynamic, 4, dynamic, dynamic, 6});
auto A = std::make_shared<op::Parameter>(element::f32,
PartialShape{dynamic, 4, dynamic, dynamic, 6});
auto B = std::make_shared<op::Parameter>(element::f32,
PartialShape{dynamic, 4, dynamic, dynamic, 6});
const auto op = std::make_shared<TypeParam>(A, B);
const auto op = std::make_shared<TypeParam>(A, B);
ASSERT_EQ(op->get_element_type(), element::f32);
ASSERT_EQ(op->get_output_partial_shape(0),
(PartialShape{dynamic, 4, dynamic, dynamic, 6}));
ASSERT_EQ(op->get_output_partial_shape(0), (PartialShape{dynamic, 4, dynamic, dynamic, 6}));
}
TYPED_TEST_P(ArithmeticOperator, full_dynamic_shape)
@@ -203,21 +202,21 @@ TYPED_TEST_P(ArithmeticOperator, full_dynamic_shape)
ASSERT_TRUE(op->get_output_partial_shape(0).same_scheme(PartialShape::dynamic()));
}
REGISTER_TYPED_TEST_CASE_P(ArithmeticOperator,
shape_inference_2D,
shape_inference_4D,
default_autobroadcast,
no_autobroadcast,
shape_inference_4D_x_scalar_numpy_broadcast,
shape_inference_4D_x_1D_numpy_broadcast,
shape_inference_2D_x_4D_numpy_broadcast,
shape_inference_3D_x_4D_numpy_broadcast,
shape_inference_4D_x_3D_numpy_broadcast,
incompatible_element_types,
incompatible_boolean_type,
shape_inference_1D_x_1D_incompatible,
shape_inference_3D_x_3D_incompatible,
shape_inference_5D_x_5D_incompatible,
dynamic_shape_3D,
dynamic_shape_5D,
full_dynamic_shape);
REGISTER_TYPED_TEST_SUITE_P(ArithmeticOperator,
shape_inference_2D,
shape_inference_4D,
default_autobroadcast,
no_autobroadcast,
shape_inference_4D_x_scalar_numpy_broadcast,
shape_inference_4D_x_1D_numpy_broadcast,
shape_inference_2D_x_4D_numpy_broadcast,
shape_inference_3D_x_4D_numpy_broadcast,
shape_inference_4D_x_3D_numpy_broadcast,
incompatible_element_types,
incompatible_boolean_type,
shape_inference_1D_x_1D_incompatible,
shape_inference_3D_x_3D_incompatible,
shape_inference_5D_x_5D_incompatible,
dynamic_shape_3D,
dynamic_shape_5D,
full_dynamic_shape);

View File

@@ -6,4 +6,4 @@
using Type = ::testing::Types<ngraph::op::Asin>;
INSTANTIATE_TYPED_TEST_CASE_P(type_prop_asin, UnaryOperator, Type);
INSTANTIATE_TYPED_TEST_SUITE_P(type_prop_asin, UnaryOperator, Type);

View File

@@ -24,13 +24,14 @@ struct BatchNormInferParams
double epsilon;
};
template<class T>
template <class T>
std::shared_ptr<Node> makeBatchNormOp(const BatchNormInferParams& p)
{
if(p.inputs.size() != 4)
if (p.inputs.size() != 4)
{
throw runtime_error("BatchNormInference requires 4 additional inputs for batch"
"normalization transformation");
throw runtime_error(
"BatchNormInference requires 4 additional inputs for batch"
"normalization transformation");
}
auto data_batch = make_shared<op::Parameter>(p.data_batch_et, p.data_batch_ps);
auto gamma = make_shared<op::Parameter>(p.inputs[0].in_et, p.inputs[0].in_shape);
@@ -40,25 +41,22 @@ std::shared_ptr<Node> makeBatchNormOp(const BatchNormInferParams& p)
return make_shared<T>(data_batch, gamma, beta, mean, variance, p.epsilon);
}
template<class T>
template <class T>
class BatchNormTest : public ::testing::Test
{
};
TYPED_TEST_CASE_P(BatchNormTest);
TYPED_TEST_SUITE_P(BatchNormTest);
TYPED_TEST_P(BatchNormTest, batch_norm_inference_basic_data_batch_rank_2)
{
PartialShape data_batch_shape{10, 100};
element::Type inputs_et = element::f32;
std::vector<BatchNormInferInputs> ch_inputs =
{
{inputs_et, PartialShape{100}, "gamma"},
{inputs_et, PartialShape{100}, "beta"},
{inputs_et, PartialShape{100}, "mean"},
{inputs_et, PartialShape{100}, "variance"}
};
std::vector<BatchNormInferInputs> ch_inputs = {{inputs_et, PartialShape{100}, "gamma"},
{inputs_et, PartialShape{100}, "beta"},
{inputs_et, PartialShape{100}, "mean"},
{inputs_et, PartialShape{100}, "variance"}};
double epsilon = 0.001;
@@ -76,13 +74,10 @@ TYPED_TEST_P(BatchNormTest, batch_norm_inference_basic_data_batch_rank_4)
PartialShape data_batch_shape{1, 10, 224, 224};
element::Type inputs_et = element::f16;
std::vector<BatchNormInferInputs> ch_inputs =
{
{inputs_et, PartialShape{10}, "gamma"},
{inputs_et, PartialShape{10}, "beta"},
{inputs_et, PartialShape{10}, "mean"},
{inputs_et, PartialShape{10}, "variance"}
};
std::vector<BatchNormInferInputs> ch_inputs = {{inputs_et, PartialShape{10}, "gamma"},
{inputs_et, PartialShape{10}, "beta"},
{inputs_et, PartialShape{10}, "mean"},
{inputs_et, PartialShape{10}, "variance"}};
double epsilon = 0.001;
@@ -100,13 +95,11 @@ TYPED_TEST_P(BatchNormTest, batch_norm_inference_inputs_rank_dynamic)
PartialShape data_batch_shape{PartialShape::dynamic()};
element::Type inputs_et = element::f32;
std::vector<BatchNormInferInputs> ch_inputs =
{
std::vector<BatchNormInferInputs> ch_inputs = {
{inputs_et, PartialShape::dynamic(), "gamma"},
{inputs_et, PartialShape::dynamic(), "beta"},
{inputs_et, PartialShape::dynamic(), "mean"},
{inputs_et, PartialShape::dynamic(), "variance"}
};
{inputs_et, PartialShape::dynamic(), "variance"}};
double epsilon = 0.001;
@@ -124,14 +117,12 @@ TYPED_TEST_P(BatchNormTest, batch_norm_inference_data_batch_rank_static_channel_
64, Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic()};
element::Type inputs_et = element::f32;
std::vector<BatchNormInferInputs> ch_inputs =
{
std::vector<BatchNormInferInputs> ch_inputs = {
{inputs_et, PartialShape::dynamic(), "gamma"},
{inputs_et, PartialShape::dynamic(), "beta"},
{inputs_et, PartialShape::dynamic(), "mean"},
{inputs_et, PartialShape::dynamic(), "variance"}
};
{inputs_et, PartialShape::dynamic(), "variance"}};
double epsilon = 0.001;
const BatchNormInferParams params{inputs_et, data_batch_shape, ch_inputs, epsilon};
@@ -143,21 +134,18 @@ TYPED_TEST_P(BatchNormTest, batch_norm_inference_data_batch_rank_static_channel_
PartialShape{64, Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic()}));
}
TYPED_TEST_P(
BatchNormTest,
batch_norm_inference_data_batch_rank_dynamic_some_channel_inputs_rank_static)
TYPED_TEST_P(BatchNormTest,
batch_norm_inference_data_batch_rank_dynamic_some_channel_inputs_rank_static)
{
PartialShape data_batch_shape{PartialShape::dynamic()};
element::Type input_et = element::f32;
std::vector<BatchNormInferInputs> inputs =
{
std::vector<BatchNormInferInputs> inputs = {
{input_et, PartialShape{Dimension::dynamic()}, "gamma"},
{input_et, PartialShape::dynamic(), "beta"},
{input_et, PartialShape{Dimension::dynamic()}, "mean"},
{input_et, PartialShape::dynamic(), "variance"}
};
{input_et, PartialShape::dynamic(), "variance"}};
double epsilon = 0.001;
const BatchNormInferParams params{input_et, data_batch_shape, inputs, epsilon};
@@ -174,13 +162,11 @@ TYPED_TEST_P(BatchNormTest,
PartialShape data_batch_shape{64, Dimension::dynamic(), Dimension::dynamic(), 224};
element::Type input_et = element::f32;
std::vector<BatchNormInferInputs> inputs =
{
std::vector<BatchNormInferInputs> inputs = {
{input_et, PartialShape{3}, "gamma"},
{input_et, PartialShape::dynamic(), "beta"},
{input_et, PartialShape{3}, "mean"},
{input_et, PartialShape{Dimension::dynamic()}, "variance"}
};
{input_et, PartialShape{Dimension::dynamic()}, "variance"}};
double epsilon = 0.001;
@@ -197,29 +183,22 @@ TYPED_TEST_P(BatchNormTest, batch_norm_inference_invalid_inputs_element_types)
{
PartialShape data_batch_shape{10, 100};
const std::vector<element::Type> inputs_et{
element::i32,
element::u32,
element::boolean
};
const std::vector<element::Type> inputs_et{element::i32, element::u32, element::boolean};
double eps = 0.001;
std::vector<BatchNormInferParams> bn_tests;
for (const auto& et : inputs_et)
{
std::vector<BatchNormInferInputs> ch_inputs =
{
{et, PartialShape{100}, "gamma"},
{et, PartialShape{100}, "beta"},
{et, PartialShape{100}, "mean"},
{et, PartialShape{100}, "variance"}
};
std::vector<BatchNormInferInputs> ch_inputs = {{et, PartialShape{100}, "gamma"},
{et, PartialShape{100}, "beta"},
{et, PartialShape{100}, "mean"},
{et, PartialShape{100}, "variance"}};
bn_tests.push_back(BatchNormInferParams{et, data_batch_shape, ch_inputs, eps});
}
for(const auto& params : bn_tests)
for (const auto& params : bn_tests)
{
try
{
@@ -244,48 +223,39 @@ TYPED_TEST_P(BatchNormTest, batch_norm_inference_incompatible_inputs_element_typ
const PartialShape data_batch_ps{10, 200};
// Invalid combination of element types of gamma/beta/mean/variance inputs
vector<BatchNormInferInputs> bn_ch_inputs =
{
{element::f32, PartialShape{200}, "gamma"},
{element::f32, PartialShape{200}, "beta"},
{element::f32, PartialShape{200}, "mean"},
{element::f32, PartialShape{200}, "variance"}
};
vector<BatchNormInferInputs> bn_ch_inputs = {{element::f32, PartialShape{200}, "gamma"},
{element::f32, PartialShape{200}, "beta"},
{element::f32, PartialShape{200}, "mean"},
{element::f32, PartialShape{200}, "variance"}};
const double epsilon = 0.001;
std::vector<BatchNormInferParams> bn_params;
bn_params.push_back(BatchNormInferParams{element::f16,
data_batch_ps,
bn_ch_inputs,
epsilon});
bn_params.push_back(BatchNormInferParams{element::f16, data_batch_ps, bn_ch_inputs, epsilon});
for(size_t i = 0; i < bn_ch_inputs.size(); i++)
for (size_t i = 0; i < bn_ch_inputs.size(); i++)
{
std::vector<BatchNormInferInputs> inputs = bn_ch_inputs;
(inputs[i]).in_et = element::f16;
bn_params.push_back(BatchNormInferParams{data_batch_et,
data_batch_ps,
inputs,
epsilon});
bn_params.push_back(BatchNormInferParams{data_batch_et, data_batch_ps, inputs, epsilon});
}
// Run tests with incompatible input element types
for(const auto& bn_p : bn_params)
for (const auto& bn_p : bn_params)
{
try
{
auto bn = makeBatchNormOp<TypeParam>(bn_p);
FAIL() << "Incompatible input element types not detected";
}
catch(const NodeValidationFailure& error)
catch (const NodeValidationFailure& error)
{
EXPECT_HAS_SUBSTRING(error.what(), "Input element types do not match");
}
catch(...)
catch (...)
{
FAIL() << "Input element types check failed for unexpected reason";
}
}
}
}
@@ -294,16 +264,14 @@ TYPED_TEST_P(BatchNormTest, batch_norm_inference_invalid_data_batch_input_rank)
PartialShape data_batch_shape{Dimension::dynamic()};
element::Type inputs_et = element::f32;
std::vector<BatchNormInferInputs> ch_inputs =
{
std::vector<BatchNormInferInputs> ch_inputs = {
{inputs_et, PartialShape::dynamic(), "gamma"},
{inputs_et, PartialShape::dynamic(), "beta"},
{inputs_et, PartialShape::dynamic(), "mean"},
{inputs_et, PartialShape::dynamic(), "variance"}
};
{inputs_et, PartialShape::dynamic(), "variance"}};
double epsilon = 0.001;
const BatchNormInferParams params{inputs_et, data_batch_shape, ch_inputs, epsilon};
try
{
@@ -312,8 +280,9 @@ TYPED_TEST_P(BatchNormTest, batch_norm_inference_invalid_data_batch_input_rank)
}
catch (const NodeValidationFailure& error)
{
EXPECT_HAS_SUBSTRING(error.what(),
"Input argument must have rank of at least 2 (input argument shape: {?})");
EXPECT_HAS_SUBSTRING(
error.what(),
"Input argument must have rank of at least 2 (input argument shape: {?})");
}
catch (...)
{
@@ -326,13 +295,11 @@ TYPED_TEST_P(BatchNormTest, batch_norm_inference_incompatible_channel_input_rank
PartialShape data_batch_shape{PartialShape::dynamic()};
element::Type input_et = element::f32;
std::vector<BatchNormInferInputs> inputs =
{
std::vector<BatchNormInferInputs> inputs = {
{input_et, PartialShape{3, Dimension::dynamic()}, "gamma"},
{input_et, PartialShape::dynamic(), "beta"},
{input_et, PartialShape{Dimension::dynamic()}, "mean"},
{input_et, PartialShape::dynamic(), "variance"}
};
{input_et, PartialShape::dynamic(), "variance"}};
double epsilon = 0.001;
@@ -344,8 +311,7 @@ TYPED_TEST_P(BatchNormTest, batch_norm_inference_incompatible_channel_input_rank
}
catch (const NodeValidationFailure& error)
{
EXPECT_HAS_SUBSTRING(error.what(),
"Shapes for gamma/beta/mean/variance do not match");
EXPECT_HAS_SUBSTRING(error.what(), "Shapes for gamma/beta/mean/variance do not match");
}
catch (...)
{
@@ -353,19 +319,15 @@ TYPED_TEST_P(BatchNormTest, batch_norm_inference_incompatible_channel_input_rank
}
}
TYPED_TEST_P(BatchNormTest,
batch_norm_inference_incompatible_channel_inputs_channel_count)
TYPED_TEST_P(BatchNormTest, batch_norm_inference_incompatible_channel_inputs_channel_count)
{
PartialShape data_batch_shape{PartialShape::dynamic()};
element::Type input_et = element::f32;
std::vector<BatchNormInferInputs> inputs =
{
{input_et, PartialShape{3}, "gamma"},
{input_et, PartialShape::dynamic(), "beta"},
{input_et, PartialShape{4}, "mean"},
{input_et, PartialShape::dynamic(), "variance"}
};
std::vector<BatchNormInferInputs> inputs = {{input_et, PartialShape{3}, "gamma"},
{input_et, PartialShape::dynamic(), "beta"},
{input_et, PartialShape{4}, "mean"},
{input_et, PartialShape::dynamic(), "variance"}};
double epsilon = 0.001;
@@ -377,12 +339,12 @@ TYPED_TEST_P(BatchNormTest,
}
catch (const NodeValidationFailure& error)
{
EXPECT_HAS_SUBSTRING(error.what(),
"Shapes for gamma/beta/mean/variance do not match");
EXPECT_HAS_SUBSTRING(error.what(), "Shapes for gamma/beta/mean/variance do not match");
}
catch (...)
{
FAIL() << "gamma/beta/mean/variance inputs channel count check failed for unexpected reason";
FAIL()
<< "gamma/beta/mean/variance inputs channel count check failed for unexpected reason";
}
}
@@ -391,13 +353,11 @@ TYPED_TEST_P(BatchNormTest, batch_norm_inference_invalid_channel_inputs_rank)
PartialShape data_batch_shape{PartialShape::dynamic()};
element::Type input_et = element::f32;
std::vector<BatchNormInferInputs> inputs =
{
std::vector<BatchNormInferInputs> inputs = {
{input_et, PartialShape{Dimension::dynamic(), Dimension::dynamic()}, "gamma"},
{input_et, PartialShape::dynamic(), "beta"},
{input_et, PartialShape{Dimension::dynamic(), Dimension::dynamic()}, "mean"},
{input_et, PartialShape::dynamic(), "variance"}
};
{input_et, PartialShape::dynamic(), "variance"}};
double epsilon = 0.001;
@@ -409,9 +369,8 @@ TYPED_TEST_P(BatchNormTest, batch_norm_inference_invalid_channel_inputs_rank)
}
catch (const NodeValidationFailure& error)
{
EXPECT_HAS_SUBSTRING(
error.what(),
"Shape for gamma/beta/mean/variance ({?,?}) does not have rank 1");
EXPECT_HAS_SUBSTRING(error.what(),
"Shape for gamma/beta/mean/variance ({?,?}) does not have rank 1");
}
catch (...)
{
@@ -425,13 +384,10 @@ TYPED_TEST_P(BatchNormTest,
PartialShape data_batch_shape{64, 4, Dimension::dynamic(), 224};
element::Type input_et = element::f32;
std::vector<BatchNormInferInputs> inputs =
{
{input_et, PartialShape{3}, "gamma"},
{input_et, PartialShape::dynamic(), "beta"},
{input_et, PartialShape{3}, "mean"},
{input_et, PartialShape::dynamic(), "variance"}
};
std::vector<BatchNormInferInputs> inputs = {{input_et, PartialShape{3}, "gamma"},
{input_et, PartialShape::dynamic(), "beta"},
{input_et, PartialShape{3}, "mean"},
{input_et, PartialShape::dynamic(), "variance"}};
double epsilon = 0.001;
@@ -443,12 +399,14 @@ TYPED_TEST_P(BatchNormTest,
}
catch (const NodeValidationFailure& error)
{
EXPECT_HAS_SUBSTRING(error.what(), "Input channel dimension (4) does not match "
"shape for gamma/beta/mean/variance ({3})");
EXPECT_HAS_SUBSTRING(error.what(),
"Input channel dimension (4) does not match "
"shape for gamma/beta/mean/variance ({3})");
}
catch (...)
{
FAIL() << "Data batch and gamma/beta/mean/variance channel count check failed for unexpected reason";
FAIL() << "Data batch and gamma/beta/mean/variance channel count check failed for "
"unexpected reason";
}
}
@@ -458,16 +416,14 @@ TYPED_TEST_P(BatchNormTest, batch_norm_inference_invalid_input_channels_count_ze
Dimension::dynamic(), 0, Dimension::dynamic(), Dimension::dynamic()};
element::Type inputs_et = element::f32;
std::vector<BatchNormInferInputs> ch_inputs =
{
std::vector<BatchNormInferInputs> ch_inputs = {
{inputs_et, PartialShape::dynamic(), "gamma"},
{inputs_et, PartialShape::dynamic(), "beta"},
{inputs_et, PartialShape::dynamic(), "mean"},
{inputs_et, PartialShape::dynamic(), "variance"}
};
{inputs_et, PartialShape::dynamic(), "variance"}};
double epsilon = 0.001;
const BatchNormInferParams params{inputs_et, data_batch_shape, ch_inputs, epsilon};
try
{
@@ -489,13 +445,10 @@ TYPED_TEST_P(BatchNormTest, batch_norm_inference_invalid_epsilon)
PartialShape data_batch_shape{10, 100};
element::Type inputs_et = element::f32;
std::vector<BatchNormInferInputs> ch_inputs =
{
{inputs_et, PartialShape{100}, "gamma"},
{inputs_et, PartialShape{100}, "beta"},
{inputs_et, PartialShape{100}, "mean"},
{inputs_et, PartialShape{100}, "variance"}
};
std::vector<BatchNormInferInputs> ch_inputs = {{inputs_et, PartialShape{100}, "gamma"},
{inputs_et, PartialShape{100}, "beta"},
{inputs_et, PartialShape{100}, "mean"},
{inputs_et, PartialShape{100}, "variance"}};
double eps_neg = -1.0;
const BatchNormInferParams params{inputs_et, data_batch_shape, ch_inputs, eps_neg};
@@ -506,7 +459,9 @@ TYPED_TEST_P(BatchNormTest, batch_norm_inference_invalid_epsilon)
}
catch (const NodeValidationFailure& error)
{
EXPECT_HAS_SUBSTRING(error.what(), "Attribute 'epsilon' must be a floating-point value greater than or equal to zero.");
EXPECT_HAS_SUBSTRING(
error.what(),
"Attribute 'epsilon' must be a floating-point value greater than or equal to zero.");
}
catch (...)
{
@@ -514,7 +469,7 @@ TYPED_TEST_P(BatchNormTest, batch_norm_inference_invalid_epsilon)
}
}
REGISTER_TYPED_TEST_CASE_P(
REGISTER_TYPED_TEST_SUITE_P(
BatchNormTest,
batch_norm_inference_basic_data_batch_rank_2,
batch_norm_inference_basic_data_batch_rank_4,
@@ -533,4 +488,4 @@ REGISTER_TYPED_TEST_CASE_P(
batch_norm_inference_invalid_epsilon);
using Types = ::testing::Types<op::v0::BatchNormInference, op::v5::BatchNormInference>;
INSTANTIATE_TYPED_TEST_CASE_P(type_prop, BatchNormTest, Types);
INSTANTIATE_TYPED_TEST_SUITE_P(type_prop, BatchNormTest, Types);

View File

@@ -17,7 +17,7 @@ template <typename T>
class BroadcastTests : public ::testing::Test
{
};
TYPED_TEST_CASE_P(BroadcastTests);
TYPED_TEST_SUITE_P(BroadcastTests);
TYPED_TEST_P(BroadcastTests, broadcast_numpy)
{
@@ -617,41 +617,41 @@ TYPED_TEST_P(BroadcastTests, broadcast_numpy_static_dims_incorrect)
}
}
REGISTER_TYPED_TEST_CASE_P(BroadcastTests,
broadcast_numpy,
broadcast_axes_mapping,
broadcast_target_shape_as_concat_with_constants,
broadcast_target_shape_as_concat_with_node,
broadcast_fail_rank,
broadcast_fail_transpose,
broadcast_fail_axes_map,
broadcast_fail_axes_map_shape,
broadcast_axes_wrong_rank,
broadcast_fully_dynamic_target_shape,
broadcast_dynamic_values_of_target_shape,
broadcast_broadcast_shape_et_wrong,
broadcast_axes_et_wrong,
broadcast_explicit_all_inputs_dynamic,
broadcast_explicit_target_shape_static_rank,
broadcast_explicit_const_target_shape,
broadcast_explicit_input_rank_static,
broadcast_explicit_target_shape_and_input_data_rank_static,
broadcast_explicit_const_target_shape_static_rank_input,
broadcast_explicit_static_input_shape,
broadcast_explicit_static_input_shape_const_target_shape,
broadcast_explicit_static_target_shape,
broadcast_numpy_input_shape_dynamic,
broadcast_numpy_target_shape_constant,
broadcast_numpy_target_shape_dynamic,
broadcast_numpy_input_target_shape_static_rank,
broadcast_numpy_input_static_shape,
broadcast_numpy_input_partially_dynamic,
broadcast_numpy_static_dims_incorrect);
REGISTER_TYPED_TEST_SUITE_P(BroadcastTests,
broadcast_numpy,
broadcast_axes_mapping,
broadcast_target_shape_as_concat_with_constants,
broadcast_target_shape_as_concat_with_node,
broadcast_fail_rank,
broadcast_fail_transpose,
broadcast_fail_axes_map,
broadcast_fail_axes_map_shape,
broadcast_axes_wrong_rank,
broadcast_fully_dynamic_target_shape,
broadcast_dynamic_values_of_target_shape,
broadcast_broadcast_shape_et_wrong,
broadcast_axes_et_wrong,
broadcast_explicit_all_inputs_dynamic,
broadcast_explicit_target_shape_static_rank,
broadcast_explicit_const_target_shape,
broadcast_explicit_input_rank_static,
broadcast_explicit_target_shape_and_input_data_rank_static,
broadcast_explicit_const_target_shape_static_rank_input,
broadcast_explicit_static_input_shape,
broadcast_explicit_static_input_shape_const_target_shape,
broadcast_explicit_static_target_shape,
broadcast_numpy_input_shape_dynamic,
broadcast_numpy_target_shape_constant,
broadcast_numpy_target_shape_dynamic,
broadcast_numpy_input_target_shape_static_rank,
broadcast_numpy_input_static_shape,
broadcast_numpy_input_partially_dynamic,
broadcast_numpy_static_dims_incorrect);
typedef ::testing::Types<op::v1::Broadcast, op::v3::Broadcast> BroadcastTypes;
// the last empty argument resolves compiler warning on MAC:
// `must specify at least one argument for '...'` (variadic macro)
INSTANTIATE_TYPED_TEST_CASE_P(type_prop, BroadcastTests, BroadcastTypes, );
INSTANTIATE_TYPED_TEST_SUITE_P(type_prop, BroadcastTests, BroadcastTypes, );
// changing AutoBroadcastSpec to BroadcastModeSpec forces runing pdpd tests separately
TEST(type_prop, broadcast_v1_pdpd)

View File

@@ -6,4 +6,4 @@
using Type = ::testing::Types<ngraph::op::Ceiling>;
INSTANTIATE_TYPED_TEST_CASE_P(type_prop_ceiling, UnaryOperator, Type);
INSTANTIATE_TYPED_TEST_SUITE_P(type_prop_ceiling, UnaryOperator, Type);

View File

@@ -282,50 +282,50 @@ TEST_P(DeduceAutoPadTest, same_lower)
EXPECT_EQ(conv->get_padding_below(), std::get<5>(GetParam()));
}
INSTANTIATE_TEST_CASE_P(type_prop,
DeduceAutoPadTest,
::testing::Values(std::make_tuple(Shape{5, 6},
Shape{3, 4},
Strides{2, 1},
Strides{1, 1},
CoordinateDiff{1, 1},
CoordinateDiff{1, 2}),
std::make_tuple(Shape{3, 3},
Shape{2, 2},
Strides{1, 1},
Strides{1, 1},
CoordinateDiff{0, 0},
CoordinateDiff{1, 1}),
std::make_tuple(Shape{28, 28},
Shape{3, 3},
Strides{2, 2},
Strides{1, 1},
CoordinateDiff{0, 0},
CoordinateDiff{1, 1}),
std::make_tuple(Shape{100, 150},
Shape{10, 20},
Strides{1, 1},
Strides{1, 1},
CoordinateDiff{4, 9},
CoordinateDiff{5, 10}),
std::make_tuple(Shape{2},
Shape{1},
Strides{3},
Strides{1},
CoordinateDiff{0},
CoordinateDiff{0}),
std::make_tuple(Shape{10, 1},
Shape{4, 1},
Strides{1, 1},
Strides{2, 1},
CoordinateDiff{3, 0},
CoordinateDiff{3, 0}),
std::make_tuple(Shape{10, 5, 6},
Shape{3, 3, 4},
Strides{1, 2, 1},
Strides{2, 1, 1},
CoordinateDiff{2, 1, 1},
CoordinateDiff{2, 1, 2})), );
INSTANTIATE_TEST_SUITE_P(type_prop,
DeduceAutoPadTest,
::testing::Values(std::make_tuple(Shape{5, 6},
Shape{3, 4},
Strides{2, 1},
Strides{1, 1},
CoordinateDiff{1, 1},
CoordinateDiff{1, 2}),
std::make_tuple(Shape{3, 3},
Shape{2, 2},
Strides{1, 1},
Strides{1, 1},
CoordinateDiff{0, 0},
CoordinateDiff{1, 1}),
std::make_tuple(Shape{28, 28},
Shape{3, 3},
Strides{2, 2},
Strides{1, 1},
CoordinateDiff{0, 0},
CoordinateDiff{1, 1}),
std::make_tuple(Shape{100, 150},
Shape{10, 20},
Strides{1, 1},
Strides{1, 1},
CoordinateDiff{4, 9},
CoordinateDiff{5, 10}),
std::make_tuple(Shape{2},
Shape{1},
Strides{3},
Strides{1},
CoordinateDiff{0},
CoordinateDiff{0}),
std::make_tuple(Shape{10, 1},
Shape{4, 1},
Strides{1, 1},
Strides{2, 1},
CoordinateDiff{3, 0},
CoordinateDiff{3, 0}),
std::make_tuple(Shape{10, 5, 6},
Shape{3, 3, 4},
Strides{1, 2, 1},
Strides{2, 1, 1},
CoordinateDiff{2, 1, 1},
CoordinateDiff{2, 1, 2})));
TEST(type_prop, conv_2d_deduce_strided)
{

View File

@@ -58,7 +58,7 @@ TEST_P(ConstantAxesAndConstantSignalSizeTest, dft_constant_axes_and_signal_size)
ASSERT_TRUE(dft->get_output_partial_shape(0).same_scheme(params.ref_output_shape));
}
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
type_prop,
ConstantAxesAndConstantSignalSizeTest,
::testing::Values(
@@ -194,10 +194,8 @@ TEST(type_prop, dft_dynamic_axes)
{
const auto input_shape = PartialShape{2, 180, 180, Dimension(1, 18)};
const auto axes_shape = PartialShape::dynamic();
const auto ref_output_shape = PartialShape{Dimension::dynamic(),
Dimension::dynamic(),
Dimension::dynamic(),
Dimension(1, 18)};
const auto ref_output_shape = PartialShape{
Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic(), Dimension(1, 18)};
auto data = std::make_shared<op::Parameter>(element::f32, input_shape);
auto axes_input = std::make_shared<op::Parameter>(element::i64, axes_shape);
@@ -230,7 +228,7 @@ TEST_P(NonConstantAxesTest, dft_non_constant_axes)
ASSERT_TRUE(dft->get_output_partial_shape(0).same_scheme(params.ref_output_shape));
}
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
type_prop,
NonConstantAxesTest,
::testing::Values(
@@ -323,7 +321,7 @@ TEST_P(NonConstantSignalSizeTest, dft_non_constant_signal_size)
ASSERT_TRUE(dft->get_output_partial_shape(0).same_scheme(params.ref_output_shape));
}
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
type_prop,
NonConstantSignalSizeTest,
::testing::Values(

View File

@@ -18,4 +18,4 @@
using Type = ::testing::Types<ngraph::op::v1::Divide>;
INSTANTIATE_TYPED_TEST_CASE_P(type_prop_divide, ArithmeticOperator, Type);
INSTANTIATE_TYPED_TEST_SUITE_P(type_prop_divide, ArithmeticOperator, Type);

View File

@@ -6,4 +6,4 @@
using Type = ::testing::Types<ngraph::op::Exp>;
INSTANTIATE_TYPED_TEST_CASE_P(type_prop_exp, UnaryOperator, Type);
INSTANTIATE_TYPED_TEST_SUITE_P(type_prop_exp, UnaryOperator, Type);

View File

@@ -138,7 +138,7 @@ TEST_P(GridGeneratorIntervalsTest, detectron_grid_generator_dynamic_shapes_inter
ASSERT_TRUE(grid_gen->get_output_partial_shape(0).same_scheme(params.ref_out_shape));
}
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
type_prop,
GridGeneratorIntervalsTest,
::testing::Values(

View File

@@ -124,7 +124,7 @@ TEST_P(ROIFeatureIntervalsTest, detectron_roi_feature_extractor_intervals_1)
ASSERT_TRUE(roi->get_output_partial_shape(0).same_scheme(ref_out_shape));
}
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
type_prop,
ROIFeatureIntervalsTest,
::testing::Values(
@@ -310,7 +310,7 @@ TEST_P(ROIFeatureIntervalsSameFirstDimsTest, detectron_roi_feature_extractor_int
ASSERT_TRUE(roi->get_output_partial_shape(0).same_scheme(ref_out_shape));
}
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
type_prop,
ROIFeatureIntervalsSameFirstDimsTest,
::testing::Values(

View File

@@ -6,4 +6,4 @@
using Type = ::testing::Types<ngraph::op::Floor>;
INSTANTIATE_TYPED_TEST_CASE_P(type_prop_floor, UnaryOperator, Type);
INSTANTIATE_TYPED_TEST_SUITE_P(type_prop_floor, UnaryOperator, Type);

View File

@@ -6,4 +6,4 @@
using Type = ::testing::Types<ngraph::op::FloorMod>;
INSTANTIATE_TYPED_TEST_CASE_P(type_prop_floormod, ArithmeticOperator, Type);
INSTANTIATE_TYPED_TEST_SUITE_P(type_prop_floormod, ArithmeticOperator, Type);

View File

@@ -46,7 +46,7 @@ TEST_P(ConstantAxesAndConstantSignalSizeTest, idft_constant_axes_and_signal_size
ASSERT_TRUE(idft->get_output_partial_shape(0).same_scheme(params.ref_output_shape));
}
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
type_prop,
ConstantAxesAndConstantSignalSizeTest,
::testing::Values(
@@ -182,10 +182,8 @@ TEST(type_prop, idft_dynamic_axes)
{
const auto input_shape = PartialShape{2, 180, 180, Dimension(1, 18)};
const auto axes_shape = PartialShape::dynamic();
const auto ref_output_shape = PartialShape{Dimension::dynamic(),
Dimension::dynamic(),
Dimension::dynamic(),
Dimension(1, 18)};
const auto ref_output_shape = PartialShape{
Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic(), Dimension(1, 18)};
auto data = std::make_shared<op::Parameter>(element::f32, input_shape);
auto axes_input = std::make_shared<op::Parameter>(element::i64, axes_shape);
@@ -218,7 +216,7 @@ TEST_P(NonConstantAxesTest, idft_non_constant_axes)
ASSERT_TRUE(idft->get_output_partial_shape(0).same_scheme(params.ref_output_shape));
}
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
type_prop,
NonConstantAxesTest,
::testing::Values(
@@ -311,7 +309,7 @@ TEST_P(NonConstantSignalSizeTest, idft_non_constant_signal_size)
ASSERT_TRUE(idft->get_output_partial_shape(0).same_scheme(params.ref_output_shape));
}
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
type_prop,
NonConstantSignalSizeTest,
::testing::Values(

View File

@@ -6,4 +6,4 @@
using Type = ::testing::Types<ngraph::op::v1::Maximum>;
INSTANTIATE_TYPED_TEST_CASE_P(type_prop_maximum, ArithmeticOperator, Type);
INSTANTIATE_TYPED_TEST_SUITE_P(type_prop_maximum, ArithmeticOperator, Type);

View File

@@ -6,4 +6,4 @@
using Type = ::testing::Types<ngraph::op::v1::Minimum>;
INSTANTIATE_TYPED_TEST_CASE_P(type_prop_minimum, ArithmeticOperator, Type);
INSTANTIATE_TYPED_TEST_SUITE_P(type_prop_minimum, ArithmeticOperator, Type);

View File

@@ -6,4 +6,4 @@
using Type = ::testing::Types<ngraph::op::v1::Mod>;
INSTANTIATE_TYPED_TEST_CASE_P(type_prop_mod, ArithmeticOperator, Type);
INSTANTIATE_TYPED_TEST_SUITE_P(type_prop_mod, ArithmeticOperator, Type);

View File

@@ -18,4 +18,4 @@
using Type = ::testing::Types<ngraph::op::v1::Multiply>;
INSTANTIATE_TYPED_TEST_CASE_P(type_prop_multiply, ArithmeticOperator, Type);
INSTANTIATE_TYPED_TEST_SUITE_P(type_prop_multiply, ArithmeticOperator, Type);

View File

@@ -6,4 +6,4 @@
using Type = ::testing::Types<ngraph::op::Negative>;
INSTANTIATE_TYPED_TEST_CASE_P(type_prop_negative, UnaryOperator, Type);
INSTANTIATE_TYPED_TEST_SUITE_P(type_prop_negative, UnaryOperator, Type);

View File

@@ -6,4 +6,4 @@
using Type = ::testing::Types<ngraph::op::v1::Power>;
INSTANTIATE_TYPED_TEST_CASE_P(type_prop_power, ArithmeticOperator, Type);
INSTANTIATE_TYPED_TEST_SUITE_P(type_prop_power, ArithmeticOperator, Type);

View File

@@ -419,15 +419,15 @@ TEST_P(RangeTest, deduce_shape_f64)
run_range_test<double>(element::f64, GetParam());
}
INSTANTIATE_TEST_CASE_P(type_prop,
RangeTest,
::testing::Values(RangeParams{0, 5, 1, PartialShape{5}},
RangeParams{0, 22, 2, PartialShape{11}},
RangeParams{1, 23, 2, PartialShape{11}},
RangeParams{1, 22, 2, PartialShape{11}},
RangeParams{0, 0, 1, PartialShape{0}},
RangeParams{1, 0, 2, PartialShape{0}}),
PrintToDummyParamName());
INSTANTIATE_TEST_SUITE_P(type_prop,
RangeTest,
::testing::Values(RangeParams{0, 5, 1, PartialShape{5}},
RangeParams{0, 22, 2, PartialShape{11}},
RangeParams{1, 23, 2, PartialShape{11}},
RangeParams{1, 22, 2, PartialShape{11}},
RangeParams{0, 0, 1, PartialShape{0}},
RangeParams{1, 0, 2, PartialShape{0}}),
PrintToDummyParamName());
struct RangeTestWithNegatives : ::testing::TestWithParam<RangeParams>
{
@@ -473,14 +473,14 @@ TEST_P(RangeTestWithNegatives, deduce_shape_f64)
run_range_test<double>(element::f64, GetParam());
}
INSTANTIATE_TEST_CASE_P(type_prop,
RangeTestWithNegatives,
::testing::Values(RangeParams{2, 0, -2, PartialShape{1}},
RangeParams{2, 0, -1, PartialShape{2}},
RangeParams{-19, 19, 1, PartialShape{38}},
RangeParams{-19, 19, 3, PartialShape{13}},
RangeParams{20, -19, 1, PartialShape{0}}),
PrintToDummyParamName());
INSTANTIATE_TEST_SUITE_P(type_prop,
RangeTestWithNegatives,
::testing::Values(RangeParams{2, 0, -2, PartialShape{1}},
RangeParams{2, 0, -1, PartialShape{2}},
RangeParams{-19, 19, 1, PartialShape{38}},
RangeParams{-19, 19, 3, PartialShape{13}},
RangeParams{20, -19, 1, PartialShape{0}}),
PrintToDummyParamName());
struct RangeTestFloating : ::testing::TestWithParam<RangeParams>
{
@@ -506,12 +506,12 @@ TEST_P(RangeTestFloating, deduce_shape_f64)
run_range_test<double>(element::f64, GetParam());
}
INSTANTIATE_TEST_CASE_P(type_prop,
RangeTestFloating,
::testing::Values(RangeParams{0, 1, 0.25, PartialShape{4}},
RangeParams{-1, 1, 0.25, PartialShape{8}},
RangeParams{-1, 0.875, 0.25, PartialShape{8}}),
PrintToDummyParamName());
INSTANTIATE_TEST_SUITE_P(type_prop,
RangeTestFloating,
::testing::Values(RangeParams{0, 1, 0.25, PartialShape{4}},
RangeParams{-1, 1, 0.25, PartialShape{8}},
RangeParams{-1, 0.875, 0.25, PartialShape{8}}),
PrintToDummyParamName());
// ------------------------------ V4 ------------------------------
@@ -973,15 +973,15 @@ TEST_P(RangeNumpyTest, deduce_shape_f64)
run_range_v4_test<double>(element::f64, GetParam());
}
INSTANTIATE_TEST_CASE_P(type_prop,
RangeNumpyTest,
::testing::Values(RangeParams{0, 5, 1, PartialShape{5}},
RangeParams{0, 22, 2, PartialShape{11}},
RangeParams{1, 23, 2, PartialShape{11}},
RangeParams{1, 22, 2, PartialShape{11}},
RangeParams{0, 0, 1, PartialShape{0}},
RangeParams{1, 0, 2, PartialShape{0}}),
PrintToDummyParamName());
INSTANTIATE_TEST_SUITE_P(type_prop,
RangeNumpyTest,
::testing::Values(RangeParams{0, 5, 1, PartialShape{5}},
RangeParams{0, 22, 2, PartialShape{11}},
RangeParams{1, 23, 2, PartialShape{11}},
RangeParams{1, 22, 2, PartialShape{11}},
RangeParams{0, 0, 1, PartialShape{0}},
RangeParams{1, 0, 2, PartialShape{0}}),
PrintToDummyParamName());
struct RangeNumpyTestWithNegatives : ::testing::TestWithParam<RangeParams>
{
@@ -1027,14 +1027,14 @@ TEST_P(RangeNumpyTestWithNegatives, deduce_shape_f64)
run_range_v4_test<double>(element::f64, GetParam());
}
INSTANTIATE_TEST_CASE_P(type_prop,
RangeNumpyTestWithNegatives,
::testing::Values(RangeParams{2, 0, -2, PartialShape{1}},
RangeParams{2, 0, -1, PartialShape{2}},
RangeParams{-19, 19, 1, PartialShape{38}},
RangeParams{-19, 19, 3, PartialShape{13}},
RangeParams{20, -19, 1, PartialShape{0}}),
PrintToDummyParamName());
INSTANTIATE_TEST_SUITE_P(type_prop,
RangeNumpyTestWithNegatives,
::testing::Values(RangeParams{2, 0, -2, PartialShape{1}},
RangeParams{2, 0, -1, PartialShape{2}},
RangeParams{-19, 19, 1, PartialShape{38}},
RangeParams{-19, 19, 3, PartialShape{13}},
RangeParams{20, -19, 1, PartialShape{0}}),
PrintToDummyParamName());
struct RangeNumpyTestFloating : ::testing::TestWithParam<RangeParams>
{
@@ -1060,9 +1060,9 @@ TEST_P(RangeNumpyTestFloating, deduce_shape_f64)
run_range_v4_test<double>(element::f64, GetParam());
}
INSTANTIATE_TEST_CASE_P(type_prop,
RangeNumpyTestFloating,
::testing::Values(RangeParams{0, 1, 0.25, PartialShape{4}},
RangeParams{-1, 1, 0.25, PartialShape{8}},
RangeParams{-1, 0.875, 0.25, PartialShape{8}}),
PrintToDummyParamName());
INSTANTIATE_TEST_SUITE_P(type_prop,
RangeNumpyTestFloating,
::testing::Values(RangeParams{0, 1, 0.25, PartialShape{4}},
RangeParams{-1, 1, 0.25, PartialShape{8}},
RangeParams{-1, 0.875, 0.25, PartialShape{8}}),
PrintToDummyParamName());

View File

@@ -5,5 +5,5 @@
#include "reduce_ops.hpp"
using Type = ::testing::Types<op::v4::ReduceL1>;
INSTANTIATE_TYPED_TEST_CASE_P(type_prop_reduce_l1, ReduceTest, Type);
INSTANTIATE_TYPED_TEST_CASE_P(type_prop_reduce_l1_et, ReduceArithmeticTest, Type);
INSTANTIATE_TYPED_TEST_SUITE_P(type_prop_reduce_l1, ReduceTest, Type);
INSTANTIATE_TYPED_TEST_SUITE_P(type_prop_reduce_l1_et, ReduceArithmeticTest, Type);

View File

@@ -5,5 +5,5 @@
#include "reduce_ops.hpp"
using Type = ::testing::Types<op::v4::ReduceL2>;
INSTANTIATE_TYPED_TEST_CASE_P(type_prop_reduce_l2, ReduceTest, Type);
INSTANTIATE_TYPED_TEST_CASE_P(type_prop_reduce_l2_et, ReduceArithmeticTest, Type);
INSTANTIATE_TYPED_TEST_SUITE_P(type_prop_reduce_l2, ReduceTest, Type);
INSTANTIATE_TYPED_TEST_SUITE_P(type_prop_reduce_l2_et, ReduceArithmeticTest, Type);

View File

@@ -5,5 +5,5 @@
#include "reduce_ops.hpp"
using Type = ::testing::Types<op::v1::ReduceLogicalAnd>;
INSTANTIATE_TYPED_TEST_CASE_P(type_prop_reduce_logical_and, ReduceTest, Type);
INSTANTIATE_TYPED_TEST_CASE_P(type_prop_reduce_logical_and_et, ReduceLogicalTest, Type);
INSTANTIATE_TYPED_TEST_SUITE_P(type_prop_reduce_logical_and, ReduceTest, Type);
INSTANTIATE_TYPED_TEST_SUITE_P(type_prop_reduce_logical_and_et, ReduceLogicalTest, Type);

View File

@@ -5,5 +5,5 @@
#include "reduce_ops.hpp"
using Type = ::testing::Types<op::v1::ReduceLogicalOr>;
INSTANTIATE_TYPED_TEST_CASE_P(type_prop_reduce_logical_or, ReduceTest, Type);
INSTANTIATE_TYPED_TEST_CASE_P(type_prop_reduce_logical_or_et, ReduceLogicalTest, Type);
INSTANTIATE_TYPED_TEST_SUITE_P(type_prop_reduce_logical_or, ReduceTest, Type);
INSTANTIATE_TYPED_TEST_SUITE_P(type_prop_reduce_logical_or_et, ReduceLogicalTest, Type);

View File

@@ -5,5 +5,5 @@
#include "reduce_ops.hpp"
using Type = ::testing::Types<op::v1::ReduceMax>;
INSTANTIATE_TYPED_TEST_CASE_P(type_prop_reduce_max, ReduceTest, Type);
INSTANTIATE_TYPED_TEST_CASE_P(type_prop_reduce_max_et, ReduceArithmeticTest, Type);
INSTANTIATE_TYPED_TEST_SUITE_P(type_prop_reduce_max, ReduceTest, Type);
INSTANTIATE_TYPED_TEST_SUITE_P(type_prop_reduce_max_et, ReduceArithmeticTest, Type);

View File

@@ -5,5 +5,5 @@
#include "reduce_ops.hpp"
using Type = ::testing::Types<op::v1::ReduceMean>;
INSTANTIATE_TYPED_TEST_CASE_P(type_prop_reduce_mean, ReduceTest, Type);
INSTANTIATE_TYPED_TEST_CASE_P(type_prop_reduce_mean_et, ReduceArithmeticTest, Type);
INSTANTIATE_TYPED_TEST_SUITE_P(type_prop_reduce_mean, ReduceTest, Type);
INSTANTIATE_TYPED_TEST_SUITE_P(type_prop_reduce_mean_et, ReduceArithmeticTest, Type);

View File

@@ -5,5 +5,5 @@
#include "reduce_ops.hpp"
using Type = ::testing::Types<op::v1::ReduceMin>;
INSTANTIATE_TYPED_TEST_CASE_P(type_prop_reduce_min, ReduceTest, Type);
INSTANTIATE_TYPED_TEST_CASE_P(type_prop_reduce_min_et, ReduceArithmeticTest, Type);
INSTANTIATE_TYPED_TEST_SUITE_P(type_prop_reduce_min, ReduceTest, Type);
INSTANTIATE_TYPED_TEST_SUITE_P(type_prop_reduce_min_et, ReduceArithmeticTest, Type);

View File

@@ -19,7 +19,7 @@ struct ReduceParams
bool keep_dims;
};
template<class T>
template <class T>
static std::shared_ptr<Node> makeReduceOp(const ReduceParams& p, bool axes_as_param = false)
{
auto in_data = make_shared<op::Parameter>(p.data_et, p.data_ps);
@@ -39,12 +39,12 @@ static std::shared_ptr<Node> makeReduceOp(const ReduceParams& p, bool axes_as_pa
return make_shared<T>(in_data, in_axes, p.keep_dims);
}
template<class T>
template <class T>
class ReduceTest : public testing::Test
{
};
TYPED_TEST_CASE_P(ReduceTest);
TYPED_TEST_SUITE_P(ReduceTest);
TYPED_TEST_P(ReduceTest, reduce_basic_shape_infer)
{
@@ -290,27 +290,26 @@ TYPED_TEST_P(ReduceTest, reduce_invalid_axes_et)
}
}
REGISTER_TYPED_TEST_CASE_P(
ReduceTest,
reduce_basic_shape_infer,
reduce_basic_shape_infer_keep_dims,
reduce_basic_shape_infer_scalar_axis,
reduce_basic_shape_infer_axes_as_param,
reduce_dynamic_shape_data,
reduce_dynamic_shape_reduced_axes_static,
reduce_dynamic_shape_reduced_axes_static_keep_dims,
reduce_dynamic_shape_reduced_axes_not_static,
reduce_dynamic_shape_reduced_axes_not_static_keep_dims,
reduce_invalid_axis_out_of_range,
reduce_invalid_axes_shape,
reduce_invalid_axes_et);
REGISTER_TYPED_TEST_SUITE_P(ReduceTest,
reduce_basic_shape_infer,
reduce_basic_shape_infer_keep_dims,
reduce_basic_shape_infer_scalar_axis,
reduce_basic_shape_infer_axes_as_param,
reduce_dynamic_shape_data,
reduce_dynamic_shape_reduced_axes_static,
reduce_dynamic_shape_reduced_axes_static_keep_dims,
reduce_dynamic_shape_reduced_axes_not_static,
reduce_dynamic_shape_reduced_axes_not_static_keep_dims,
reduce_invalid_axis_out_of_range,
reduce_invalid_axes_shape,
reduce_invalid_axes_et);
template<class T>
template <class T>
class ReduceArithmeticTest : public testing::Test
{
};
TYPED_TEST_CASE_P(ReduceArithmeticTest);
TYPED_TEST_SUITE_P(ReduceArithmeticTest);
TYPED_TEST_P(ReduceArithmeticTest, reduce_arithmetic_invalid_data_et)
{
@@ -339,23 +338,18 @@ TYPED_TEST_P(ReduceArithmeticTest, reduce_arithmetic_invalid_data_et)
}
}
REGISTER_TYPED_TEST_CASE_P(
ReduceArithmeticTest,
reduce_arithmetic_invalid_data_et);
REGISTER_TYPED_TEST_SUITE_P(ReduceArithmeticTest, reduce_arithmetic_invalid_data_et);
template<class T>
template <class T>
class ReduceLogicalTest : public testing::Test
{
};
TYPED_TEST_CASE_P(ReduceLogicalTest);
TYPED_TEST_SUITE_P(ReduceLogicalTest);
TYPED_TEST_P(ReduceLogicalTest, reduce_logical_invalid_data_et)
{
std::vector<element::Type> element_types{
element::f32,
element::i32,
element::u32};
std::vector<element::Type> element_types{element::f32, element::i32, element::u32};
PartialShape data_ps{1, 2, 3};
element::Type axes_et = element::i32;
@@ -380,9 +374,7 @@ TYPED_TEST_P(ReduceLogicalTest, reduce_logical_invalid_data_et)
{
FAIL() << "Data input element type validation check failed for unexpected reason";
}
}
}
}
REGISTER_TYPED_TEST_CASE_P(
ReduceLogicalTest,
reduce_logical_invalid_data_et);
REGISTER_TYPED_TEST_SUITE_P(ReduceLogicalTest, reduce_logical_invalid_data_et);

View File

@@ -5,5 +5,5 @@
#include "reduce_ops.hpp"
using Type = ::testing::Types<op::v1::ReduceProd>;
INSTANTIATE_TYPED_TEST_CASE_P(type_prop_reduce_prod, ReduceTest, Type);
INSTANTIATE_TYPED_TEST_CASE_P(type_prop_reduce_prod_et, ReduceArithmeticTest, Type);
INSTANTIATE_TYPED_TEST_SUITE_P(type_prop_reduce_prod, ReduceTest, Type);
INSTANTIATE_TYPED_TEST_SUITE_P(type_prop_reduce_prod_et, ReduceArithmeticTest, Type);

View File

@@ -5,5 +5,5 @@
#include "reduce_ops.hpp"
using Type = ::testing::Types<op::v1::ReduceSum>;
INSTANTIATE_TYPED_TEST_CASE_P(type_prop_reduce_sum, ReduceTest, Type);
INSTANTIATE_TYPED_TEST_CASE_P(type_prop_reduce_sum_et, ReduceArithmeticTest, Type);
INSTANTIATE_TYPED_TEST_SUITE_P(type_prop_reduce_sum, ReduceTest, Type);
INSTANTIATE_TYPED_TEST_SUITE_P(type_prop_reduce_sum_et, ReduceArithmeticTest, Type);

View File

@@ -274,7 +274,7 @@ TEST_P(DeduceV1SelectTest, output_shape)
ASSERT_EQ(select->get_element_type(), tp.ets[3]);
}
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
type_prop,
DeduceV1SelectTest,
::testing::Values(SelectParams({{2, 4}, {2, 4}, {2, 4}, {2, 4}},

View File

@@ -6,4 +6,4 @@
using Type = ::testing::Types<ngraph::op::Sin>;
INSTANTIATE_TYPED_TEST_CASE_P(type_prop_sin, UnaryOperator, Type);
INSTANTIATE_TYPED_TEST_SUITE_P(type_prop_sin, UnaryOperator, Type);

View File

@@ -6,4 +6,4 @@
using Type = ::testing::Types<ngraph::op::Sqrt>;
INSTANTIATE_TYPED_TEST_CASE_P(type_prop_sqrt, UnaryOperator, Type);
INSTANTIATE_TYPED_TEST_SUITE_P(type_prop_sqrt, UnaryOperator, Type);

View File

@@ -6,4 +6,4 @@
using Type = ::testing::Types<ngraph::op::SquaredDifference>;
INSTANTIATE_TYPED_TEST_CASE_P(type_prop_squared_difference, ArithmeticOperator, Type);
INSTANTIATE_TYPED_TEST_SUITE_P(type_prop_squared_difference, ArithmeticOperator, Type);

View File

@@ -18,4 +18,4 @@
using Type = ::testing::Types<ngraph::op::v1::Subtract>;
INSTANTIATE_TYPED_TEST_CASE_P(type_prop_subtract, ArithmeticOperator, Type);
INSTANTIATE_TYPED_TEST_SUITE_P(type_prop_subtract, ArithmeticOperator, Type);

View File

@@ -14,7 +14,7 @@ template <typename T>
class topk_type_prop : public ::testing::Test
{
};
TYPED_TEST_CASE_P(topk_type_prop);
TYPED_TEST_SUITE_P(topk_type_prop);
TYPED_TEST_P(topk_type_prop, topk_negative_axis_support)
{
@@ -104,12 +104,12 @@ TYPED_TEST_P(topk_type_prop, topk_rank_static_k_unknown)
}
}
REGISTER_TYPED_TEST_CASE_P(topk_type_prop,
topk_negative_axis_support,
topk_negative_axis_dynamic_rank,
topk_v1_partial_ouptut,
topk_rank_static_k_unknown,
topk_default_index_element_type);
REGISTER_TYPED_TEST_SUITE_P(topk_type_prop,
topk_negative_axis_support,
topk_negative_axis_dynamic_rank,
topk_v1_partial_ouptut,
topk_rank_static_k_unknown,
topk_default_index_element_type);
typedef ::testing::Types<op::v1::TopK, op::v3::TopK> TopKTypes;
INSTANTIATE_TYPED_TEST_CASE_P(type_prop, topk_type_prop, TopKTypes, );
INSTANTIATE_TYPED_TEST_SUITE_P(type_prop, topk_type_prop, TopKTypes, );

View File

@@ -13,7 +13,7 @@ class UnaryOperator : public testing::Test
{
};
TYPED_TEST_CASE_P(UnaryOperator);
TYPED_TEST_SUITE_P(UnaryOperator);
TYPED_TEST_P(UnaryOperator, shape_inference_Shape1)
{
@@ -84,14 +84,14 @@ TYPED_TEST_P(UnaryOperator, dynamic_rank_input_shape_full)
ASSERT_TRUE(op->get_output_partial_shape(0).same_scheme(PartialShape::dynamic()));
}
REGISTER_TYPED_TEST_CASE_P(UnaryOperator,
shape_inference_Shape1,
shape_inference_Shape2,
input_type_inference_F32,
input_type_inference_I64,
input_type_inference_U16,
incompatible_input_type_Shape1,
incompatible_input_type_Shape2,
dynamic_rank_input_shape_2D,
dynamic_rank_input_shape_3D,
dynamic_rank_input_shape_full);
REGISTER_TYPED_TEST_SUITE_P(UnaryOperator,
shape_inference_Shape1,
shape_inference_Shape2,
input_type_inference_F32,
input_type_inference_I64,
input_type_inference_U16,
incompatible_input_type_Shape1,
incompatible_input_type_Shape2,
dynamic_rank_input_shape_2D,
dynamic_rank_input_shape_3D,
dynamic_rank_input_shape_full);

View File

@@ -31,7 +31,7 @@ if(NGRAPH_LIB_VERSIONING_ENABLE)
VERSION ${NGRAPH_VERSION})
endif()
target_include_directories(ngraph_test_util PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/.. ${IE_MAIN_SOURCE_DIR}/include)
target_link_libraries(ngraph_test_util PUBLIC ngraph ngraph_backend libgtest)
target_link_libraries(ngraph_test_util PUBLIC ngraph ngraph_backend gtest gmock)
if (NGRAPH_ONNX_IMPORT_ENABLE)
target_link_libraries(ngraph_test_util PRIVATE onnx_common)
endif()

View File

@@ -16,7 +16,7 @@ namespace ngraph
std::string combine_test_backend_and_case(const std::string& backend_name,
const std::string& test_casename);
}
} // namespace ngraph
#define NGRAPH_GTEST_TEST_CLASS_NAME_(backend_name, test_case_name, test_name) \
backend_name##_##test_case_name##_##test_name##_Test
@@ -83,14 +83,14 @@ namespace ngraph
test_fixture, \
::testing::internal::GetTypeId<test_fixture>())
// NGRAPH_TEST_P combined with NGRAPH_INSTANTIATE_TEST_CASE_P facilate the generation
// of value parameterized tests (similar to the original TEST_P and INSTANTIATE_TEST_CASE_P
// NGRAPH_TEST_P combined with NGRAPH_INSTANTIATE_TEST_SUITE_P facilate the generation
// of value parameterized tests (similar to the original TEST_P and INSTANTIATE_TEST_SUITE_P
// with the addition of a new 0th parameter for the backend name, which allows nGraph's
// manifest controlled unit testing).
//
// Start by defining a class derived from ::testing::TestWithParam<T>, which you'll pass
// for the test_case_name parameter.
// Then use NGRAPH_INSTANTIATE_TEST_CASE_P to define each generation of test cases (see below).
// Then use NGRAPH_INSTANTIATE_TEST_SUITE_P to define each generation of test cases (see below).
#define NGRAPH_TEST_P(backend_name, test_case_name, test_name) \
class NGRAPH_GTEST_TEST_CLASS_NAME_(backend_name, test_case_name, test_name) \
: public test_case_name \
@@ -126,59 +126,59 @@ namespace ngraph
NGRAPH_GTEST_TEST_CLASS_NAME_(backend_name, test_case_name, test_name)::AddToRegistry(); \
void NGRAPH_GTEST_TEST_CLASS_NAME_(backend_name, test_case_name, test_name)::TestBody()
// Use NGRAPH_INSTANTIATE_TEST_CASE_P to create a generated set of test case variations.
// Use NGRAPH_INSTANTIATE_TEST_SUITE_P to create a generated set of test case variations.
// The prefix parameter is a label that you optionally provide (no quotes) for a unique
// test name (helpful for labelling a set of inputs and for filtering).
// The prefix parameter can be skipped by simply using a bare comma (see example below).
//
// Unlike INSTANTIATE_TEST_CASE_P we don't currently support passing a custom param
// Unlike INSTANTIATE_TEST_SUITE_P we don't currently support passing a custom param
// name generator. Supporting this with a single macro name requires the use of
// ... and __VA_ARGS__ which in turn generates a warning using INSTANTIATE_TEST_CASE_P
// ... and __VA_ARGS__ which in turn generates a warning using INSTANTIATE_TEST_SUITE_P
// without a trailing , parameter.
//
// Examples:
// NGRAPH_INSTANTIATE_TEST_CASE_P(BACKENDNAME, // backend_name
// NGRAPH_INSTANTIATE_TEST_SUITE_P(BACKENDNAME, // backend_name
// , // empty/skipped prefix
// TestWithParamSubClass, // test_case_name
// TestWithParamSubClass, // test_suite_name
// ::testing::Range(0, 3) ) // test generator
// would generate:
// BACKENDNAME/TestWithParamSubClass.test_name/0
// BACKENDNAME/TestWithParamSubClass.test_name/1
// BACKENDNAME/TestWithParamSubClass.test_name/2
//
// NGRAPH_INSTANTIATE_TEST_CASE_P(BACKENDNAME, // backend_name
// NGRAPH_INSTANTIATE_TEST_SUITE_P(BACKENDNAME, // backend_name
// NumericRangeTests, // prefix
// TestWithParamSubClass, // test_case_name
// TestWithParamSubClass, // test_suite_name
// ::testing::Range(0, 3) ) // test generator
// would generate:
// BACKENDNAME/NumericRangeTests/BACKENDNAME/TestWithParamSubClass.test_name/0
// BACKENDNAME/NumericRangeTests/BACKENDNAME/TestWithParamSubClass.test_name/1
// BACKENDNAME/NumericRangeTests/BACKENDNAME/TestWithParamSubClass.test_name/2
//
// With the use of NGRAPH_TEST_P and NGRAPH_INSTANTIATE_TEST_CASE_P
// With the use of NGRAPH_TEST_P and NGRAPH_INSTANTIATE_TEST_SUITE_P
// the filter to run all the tests for a given backend should be:
// --gtest_filter=BACKENDNAME*.*
// (rather than the BACKENDNAME.* that worked before the use of NGRAPH_TEST_P)
#define NGRAPH_INSTANTIATE_TEST_CASE_P(backend_name, prefix, test_case_name, generator) \
static ::testing::internal::ParamGenerator<test_case_name::ParamType> \
gtest_##prefix##backend_name##test_case_name##_EvalGenerator_() \
#define NGRAPH_INSTANTIATE_TEST_SUITE_P(backend_name, prefix, test_suite_name, generator) \
static ::testing::internal::ParamGenerator<test_suite_name::ParamType> \
gtest_##prefix##backend_name##test_suite_name##_EvalGenerator_() \
{ \
return generator; \
} \
static ::std::string gtest_##prefix##backend_name##test_case_name##_EvalGenerateName_( \
const ::testing::TestParamInfo<test_case_name::ParamType>& info) \
static ::std::string gtest_##prefix##backend_name##test_suite_name##_EvalGenerateName_( \
const ::testing::TestParamInfo<test_suite_name::ParamType>& info) \
{ \
return ::testing::internal::GetParamNameGen<test_case_name::ParamType>()(info); \
return ::testing::internal::DefaultParamName<test_suite_name::ParamType>(info); \
} \
static int gtest_##prefix##backend_name##test_case_name##_dummy_ GTEST_ATTRIBUTE_UNUSED_ = \
static int gtest_##prefix##backend_name##test_suite_name##_dummy_ GTEST_ATTRIBUTE_UNUSED_ = \
::testing::UnitTest::GetInstance() \
->parameterized_test_registry() \
.GetTestCasePatternHolder<test_case_name>( \
#backend_name "/" #test_case_name, \
.GetTestCasePatternHolder<test_suite_name>( \
#backend_name "/" #test_suite_name, \
::testing::internal::CodeLocation(__FILE__, __LINE__)) \
->AddTestCaseInstantiation( \
->AddTestSuiteInstantiation( \
#prefix[0] != '\0' ? #backend_name "/" #prefix : "", \
&gtest_##prefix##backend_name##test_case_name##_EvalGenerator_, \
&gtest_##prefix##backend_name##test_case_name##_EvalGenerateName_, \
&gtest_##prefix##backend_name##test_suite_name##_EvalGenerator_, \
&gtest_##prefix##backend_name##test_suite_name##_EvalGenerateName_, \
__FILE__, \
__LINE__)

View File

@@ -18,12 +18,12 @@ using namespace ngraph;
using ngraph::test::NodeBuilder;
using ngraph::test::ValueMap;
template<class T>
template <class T>
class BatchNormAttrTest : public ::testing::Test
{
};
TYPED_TEST_CASE_P(BatchNormAttrTest);
TYPED_TEST_SUITE_P(BatchNormAttrTest);
TYPED_TEST_P(BatchNormAttrTest, batch_norm_inference_op)
{
@@ -47,10 +47,8 @@ TYPED_TEST_P(BatchNormAttrTest, batch_norm_inference_op)
EXPECT_EQ(g_batch_norm->get_eps_value(), batch_norm->get_eps_value());
}
REGISTER_TYPED_TEST_CASE_P(
BatchNormAttrTest,
batch_norm_inference_op);
REGISTER_TYPED_TEST_SUITE_P(BatchNormAttrTest, batch_norm_inference_op);
using Types = ::testing::Types<op::v0::BatchNormInference, op::v5::BatchNormInference>;
INSTANTIATE_TYPED_TEST_CASE_P(attributes, BatchNormAttrTest, Types);
INSTANTIATE_TYPED_TEST_SUITE_P(attributes, BatchNormAttrTest, Types);

View File

@@ -5,7 +5,7 @@
#include "unary_ops.hpp"
using Type = ::testing::Types<UnaryOperatorType<ngraph::op::v0::Ceiling, element::f32>>;
INSTANTIATE_TYPED_TEST_CASE_P(visitor_without_attribute,
UnaryOperatorVisitor,
Type,
UnaryOperatorTypeName);
INSTANTIATE_TYPED_TEST_SUITE_P(visitor_without_attribute,
UnaryOperatorVisitor,
Type,
UnaryOperatorTypeName);

View File

@@ -7,7 +7,7 @@
using Types = ::testing::Types<UnaryOperatorType<ngraph::op::v0::Floor, element::f32>,
UnaryOperatorType<ngraph::op::v0::Floor, element::f16>>;
INSTANTIATE_TYPED_TEST_CASE_P(visitor_without_attribute,
UnaryOperatorVisitor,
Types,
UnaryOperatorTypeName);
INSTANTIATE_TYPED_TEST_SUITE_P(visitor_without_attribute,
UnaryOperatorVisitor,
Types,
UnaryOperatorTypeName);

View File

@@ -5,7 +5,7 @@
using Types = ::testing::Types<UnaryOperatorType<ngraph::op::v0::Log, element::f32>,
UnaryOperatorType<ngraph::op::v0::Log, element::f16>>;
INSTANTIATE_TYPED_TEST_CASE_P(visitor_without_attribute,
UnaryOperatorVisitor,
Types,
UnaryOperatorTypeName);
INSTANTIATE_TYPED_TEST_SUITE_P(visitor_without_attribute,
UnaryOperatorVisitor,
Types,
UnaryOperatorTypeName);

View File

@@ -7,7 +7,7 @@
using Types = ::testing::Types<UnaryOperatorType<ngraph::op::v0::Negative, element::f32>,
UnaryOperatorType<ngraph::op::v0::Negative, element::i32>>;
INSTANTIATE_TYPED_TEST_CASE_P(visitor_without_attribute,
UnaryOperatorVisitor,
Types,
UnaryOperatorTypeName);
INSTANTIATE_TYPED_TEST_SUITE_P(visitor_without_attribute,
UnaryOperatorVisitor,
Types,
UnaryOperatorTypeName);

View File

@@ -5,4 +5,4 @@
#include "reduce_ops.hpp"
using Type = ::testing::Types<ngraph::op::v4::ReduceL1>;
INSTANTIATE_TYPED_TEST_CASE_P(attributes_reduce_l1, ReduceOpsAttrTest, Type);
INSTANTIATE_TYPED_TEST_SUITE_P(attributes_reduce_l1, ReduceOpsAttrTest, Type);

View File

@@ -5,4 +5,4 @@
#include "reduce_ops.hpp"
using Type = ::testing::Types<ngraph::op::v4::ReduceL2>;
INSTANTIATE_TYPED_TEST_CASE_P(attributes_reduce_l2, ReduceOpsAttrTest, Type);
INSTANTIATE_TYPED_TEST_SUITE_P(attributes_reduce_l2, ReduceOpsAttrTest, Type);

View File

@@ -5,4 +5,4 @@
#include "reduce_ops.hpp"
using Type = ::testing::Types<ngraph::op::v1::ReduceLogicalAnd>;
INSTANTIATE_TYPED_TEST_CASE_P(attributes_reduce_logical_and, ReduceOpsAttrTest, Type);
INSTANTIATE_TYPED_TEST_SUITE_P(attributes_reduce_logical_and, ReduceOpsAttrTest, Type);

View File

@@ -5,4 +5,4 @@
#include "reduce_ops.hpp"
using Type = ::testing::Types<ngraph::op::v1::ReduceLogicalOr>;
INSTANTIATE_TYPED_TEST_CASE_P(attributes_reduce_logical_or, ReduceOpsAttrTest, Type);
INSTANTIATE_TYPED_TEST_SUITE_P(attributes_reduce_logical_or, ReduceOpsAttrTest, Type);

View File

@@ -5,4 +5,4 @@
#include "reduce_ops.hpp"
using Type = ::testing::Types<ngraph::op::v1::ReduceMax>;
INSTANTIATE_TYPED_TEST_CASE_P(attributes_reduce_max, ReduceOpsAttrTest, Type);
INSTANTIATE_TYPED_TEST_SUITE_P(attributes_reduce_max, ReduceOpsAttrTest, Type);

View File

@@ -5,4 +5,4 @@
#include "reduce_ops.hpp"
using Type = ::testing::Types<ngraph::op::v1::ReduceMean>;
INSTANTIATE_TYPED_TEST_CASE_P(attributes_reduce_mean, ReduceOpsAttrTest, Type);
INSTANTIATE_TYPED_TEST_SUITE_P(attributes_reduce_mean, ReduceOpsAttrTest, Type);

View File

@@ -5,4 +5,4 @@
#include "reduce_ops.hpp"
using Type = ::testing::Types<ngraph::op::v1::ReduceMin>;
INSTANTIATE_TYPED_TEST_CASE_P(attributes_reduce_min, ReduceOpsAttrTest, Type);
INSTANTIATE_TYPED_TEST_SUITE_P(attributes_reduce_min, ReduceOpsAttrTest, Type);

View File

@@ -14,12 +14,12 @@ using namespace ngraph;
using ngraph::test::NodeBuilder;
using ngraph::test::ValueMap;
template<class T>
template <class T>
class ReduceOpsAttrTest : public ::testing::Test
{
};
TYPED_TEST_CASE_P(ReduceOpsAttrTest);
TYPED_TEST_SUITE_P(ReduceOpsAttrTest);
TYPED_TEST_P(ReduceOpsAttrTest, reduce_ops)
{
@@ -43,6 +43,4 @@ TYPED_TEST_P(ReduceOpsAttrTest, reduce_ops)
EXPECT_EQ(g_reduce_op->get_keep_dims(), reduce_op->get_keep_dims());
}
REGISTER_TYPED_TEST_CASE_P(
ReduceOpsAttrTest,
reduce_ops);
REGISTER_TYPED_TEST_SUITE_P(ReduceOpsAttrTest, reduce_ops);

View File

@@ -5,4 +5,4 @@
#include "reduce_ops.hpp"
using Type = ::testing::Types<ngraph::op::v1::ReduceProd>;
INSTANTIATE_TYPED_TEST_CASE_P(attributes_reduce_prod, ReduceOpsAttrTest, Type);
INSTANTIATE_TYPED_TEST_SUITE_P(attributes_reduce_prod, ReduceOpsAttrTest, Type);

View File

@@ -5,4 +5,4 @@
#include "reduce_ops.hpp"
using Type = ::testing::Types<ngraph::op::v1::ReduceSum>;
INSTANTIATE_TYPED_TEST_CASE_P(attributes_reduce_sum, ReduceOpsAttrTest, Type);
INSTANTIATE_TYPED_TEST_SUITE_P(attributes_reduce_sum, ReduceOpsAttrTest, Type);

View File

@@ -7,7 +7,7 @@
using Types = ::testing::Types<UnaryOperatorType<ngraph::op::v0::Result, element::f32>,
UnaryOperatorType<ngraph::op::v0::Result, element::f16>>;
INSTANTIATE_TYPED_TEST_CASE_P(visitor_without_attribute,
UnaryOperatorVisitor,
Types,
UnaryOperatorTypeName);
INSTANTIATE_TYPED_TEST_SUITE_P(visitor_without_attribute,
UnaryOperatorVisitor,
Types,
UnaryOperatorTypeName);

View File

@@ -6,7 +6,7 @@
using Types = ::testing::Types<UnaryOperatorType<ngraph::op::v4::SoftPlus, element::f32>>;
INSTANTIATE_TYPED_TEST_CASE_P(visitor_without_atrribute,
UnaryOperatorVisitor,
Types,
UnaryOperatorTypeName);
INSTANTIATE_TYPED_TEST_SUITE_P(visitor_without_atrribute,
UnaryOperatorVisitor,
Types,
UnaryOperatorTypeName);

View File

@@ -6,7 +6,7 @@
using Types = ::testing::Types<UnaryOperatorType<ngraph::op::v0::Sqrt, element::f32>,
UnaryOperatorType<ngraph::op::v0::Sqrt, element::f16>>;
INSTANTIATE_TYPED_TEST_CASE_P(visitor_without_attribute,
UnaryOperatorVisitor,
Types,
UnaryOperatorTypeName);
INSTANTIATE_TYPED_TEST_SUITE_P(visitor_without_attribute,
UnaryOperatorVisitor,
Types,
UnaryOperatorTypeName);

View File

@@ -4,9 +4,9 @@
#include "unary_ops.hpp"
using Types = ::testing::Types<UnaryOperatorType<ngraph::op::v0::Squeeze, element::f32>,
UnaryOperatorType<ngraph::op::v0::Squeeze, element::f16>>;
UnaryOperatorType<ngraph::op::v0::Squeeze, element::f16>>;
INSTANTIATE_TYPED_TEST_CASE_P(visitor_without_attribute,
UnaryOperatorVisitor,
Types,
UnaryOperatorTypeName);
INSTANTIATE_TYPED_TEST_SUITE_P(visitor_without_attribute,
UnaryOperatorVisitor,
Types,
UnaryOperatorTypeName);

View File

@@ -5,7 +5,7 @@
using Type = ::testing::Types<UnaryOperatorType<ngraph::op::v4::Swish, element::f32>>;
INSTANTIATE_TYPED_TEST_CASE_P(visitor_without_atrribute,
UnaryOperatorVisitor,
Type,
UnaryOperatorTypeName);
INSTANTIATE_TYPED_TEST_SUITE_P(visitor_without_atrribute,
UnaryOperatorVisitor,
Type,
UnaryOperatorTypeName);

View File

@@ -40,7 +40,7 @@ public:
}
};
TYPED_TEST_CASE_P(UnaryOperatorVisitor);
TYPED_TEST_SUITE_P(UnaryOperatorVisitor);
TYPED_TEST_P(UnaryOperatorVisitor, No_Attribute_4D)
{
@@ -56,4 +56,4 @@ TYPED_TEST_P(UnaryOperatorVisitor, No_Attribute_4D)
EXPECT_EQ(builder.get_value_map_size(), expected_attr_count);
}
REGISTER_TYPED_TEST_CASE_P(UnaryOperatorVisitor, No_Attribute_4D);
REGISTER_TYPED_TEST_SUITE_P(UnaryOperatorVisitor, No_Attribute_4D);