diff --git a/src/core/reference/include/openvino/reference/acos.hpp b/src/core/reference/include/openvino/reference/acos.hpp index f24a46d4ab6..03a66685615 100644 --- a/src/core/reference/include/openvino/reference/acos.hpp +++ b/src/core/reference/include/openvino/reference/acos.hpp @@ -7,8 +7,21 @@ #include #include +#include "openvino/reference/utils/type_util.hpp" + namespace ov { namespace reference { +namespace func { +template ()>::type* = nullptr> +T acos(const T in) { + return std::acos(in); +} + +template ::value>::type* = nullptr> +T acos(const T in) { + return static_cast(std::round(std::acos(in))); +} +} // namespace func /** * @brief Reference implementation of Acos operator. @@ -17,11 +30,9 @@ namespace reference { * @param out Output buffer pointer with results. * @param count Number of elements in input buffer. */ -template +template void acos(const T* arg, T* out, const size_t count) { - std::transform(arg, arg + count, out, [](T in) { - return static_cast(std::acos(in)); - }); + std::transform(arg, arg + count, out, &func::acos); } } // namespace reference } // namespace ov diff --git a/src/core/reference/include/openvino/reference/acosh.hpp b/src/core/reference/include/openvino/reference/acosh.hpp index 65947842ded..009c7750b8a 100644 --- a/src/core/reference/include/openvino/reference/acosh.hpp +++ b/src/core/reference/include/openvino/reference/acosh.hpp @@ -24,7 +24,7 @@ T acosh(const T in) { } // namespace func /** - * @brief Reference implementation of Acos operator. + * @brief Reference implementation of Acosh operator. * * @param arg Input buffer pointer with input data. * @param out Output buffer pointer with results. diff --git a/src/plugins/template/tests/functional/op_reference/acos.cpp b/src/plugins/template/tests/functional/op_reference/acos.cpp index a3b51f6150d..22402222df3 100644 --- a/src/plugins/template/tests/functional/op_reference/acos.cpp +++ b/src/plugins/template/tests/functional/op_reference/acos.cpp @@ -68,15 +68,15 @@ INSTANTIATE_TEST_SUITE_P( 0.00000000f}}), Builder {} .input({{3}, element::i32, std::vector {-1, 0, 1}}) - .expected({{3}, element::i32, std::vector {3, 1, 0}}), + .expected({{3}, element::i32, std::vector {3, 2, 0}}), Builder {} .input({{3}, element::i64, std::vector {-1, 0, 1}}) - .expected({{3}, element::i64, std::vector {3, 1, 0}}), + .expected({{3}, element::i64, std::vector {3, 2, 0}}), Builder {} .input({{2}, element::u32, std::vector {0, 1}}) - .expected({{2}, element::u32, std::vector {1, 0}}), + .expected({{2}, element::u32, std::vector {2, 0}}), Builder {} .input({{2}, element::u64, std::vector {0, 1}}) - .expected({{2}, element::u64, std::vector {1, 0}})), + .expected({{2}, element::u64, std::vector {2, 0}})), ReferenceAcosLayerTest::getTestCaseName); } // namespace reference_tests