Skip to content

Commit

Permalink
add template plugin test case for uint and float
Browse files Browse the repository at this point in the history
remove the float test in backend

Signed-off-by: Hu, Yuan2 <[email protected]>
  • Loading branch information
tiger100256-hu committed Aug 3, 2021
1 parent 17a20c8 commit d917b22
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 81 deletions.
34 changes: 18 additions & 16 deletions docs/template_plugin/tests/functional/op_reference/tan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,23 +57,25 @@ TEST_P(ReferenceTanLayerTest, CompareWithHardcodedRefs) {
Exec();
}

template <element::Type_t IN_ET>
std::vector<TanParams> generateTanParamsInt(const ngraph::element::Type& type) {
using T = typename element_type_traits<IN_ET>::value_type;
std::vector<TanParams> tanParams {
TanParams(ngraph::PartialShape {5}, type, std::vector<T> {-2, -1, 0, 1, 2},
std::vector<T> {2, -2, 0, 2, -2})
};
return tanParams;
}

std::vector<TanParams> generateTanCombinedParams() {
const std::vector<std::vector<TanParams>> tanTypeParams {generateTanParamsInt<element::Type_t::i32>(ngraph::element::i32),
generateTanParamsInt<element::Type_t::i64>(ngraph::element::i64)};
std::vector<TanParams> combinedParams;
std::for_each(tanTypeParams.begin(), tanTypeParams.end(), [&](std::vector<TanParams> params) {
combinedParams.insert(combinedParams.end(), params.begin(), params.end());
});
std::vector<TanParams> combinedParams {
TanParams(ngraph::PartialShape {5}, ngraph::element::i32, std::vector<int32_t> {-2, -1, 0, 1, 2},
std::vector<int32_t> {2, -2, 0, 2, -2}),
TanParams(ngraph::PartialShape {5}, ngraph::element::i64, std::vector<int64_t> {-2, -1, 0, 1, 2},
std::vector<int64_t> {2, -2, 0, 2, -2}),
TanParams(ngraph::PartialShape {5}, ngraph::element::u32, std::vector<uint32_t> {1, 2, 3, 4, 5},
std::vector<uint32_t> {2, 0xFFFFFFFF - 1, 0, 1, 0xFFFFFFFF - 2}),
TanParams(ngraph::PartialShape {5}, ngraph::element::u64, std::vector<uint64_t> {1, 2, 3, 4, 5},
std::vector<uint64_t> {2, 0xFFFFFFFFFFFFFFFF - 1, 0, 1, 0xFFFFFFFFFFFFFFFF - 2}),
TanParams(ngraph::PartialShape {11}, ngraph::element::f32, std::vector<float> {0.f, 0.25f,
-0.25f, 0.5f, -0.5f, 1.f, -1.f, 2.f, -2.f, 4.f, -4.f},
std::vector<float> {0.00000000f, 0.25534192f, -0.25534192f, 0.54630249f, -0.54630249f,
1.55740772f, -1.55740772f, -2.18503986f, 2.18503986f, 1.15782128f, -1.15782128f}),
TanParams(ngraph::PartialShape {11}, ngraph::element::f16, std::vector<float16> {0.f, 0.25f,
-0.25f, 0.5f, -0.5f, 1.f, -1.f, 2.f, -2.f, 4.f, -4.f},
std::vector<float16> {0.00000000f, 0.25534192f, -0.25534192f, 0.54630249f, -0.54630249f,
1.55740772f, -1.55740772f, -2.18503986f, 2.18503986f, 1.15782128f, -1.15782128f})
};
return combinedParams;
}

Expand Down
1 change: 0 additions & 1 deletion ngraph/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,6 @@ set(MULTI_TEST_SRC
backend/squeeze.in.cpp
backend/subtract.in.cpp
backend/swish.in.cpp
backend/tan.in.cpp
backend/tanh.in.cpp
backend/tile.in.cpp
backend/topk.in.cpp
Expand Down
64 changes: 0 additions & 64 deletions ngraph/test/backend/tan.in.cpp

This file was deleted.

0 comments on commit d917b22

Please sign in to comment.