* minor changes in Op class and add ref impl for acosh * acosh in new test framework * add Acosh type test * add SLT for Acosh * run more test * new acosh plugin test * add visitor test * fix test utils * add template test for all supported types in Acosh * add builder to template tests * update grn template_plugin test * update maste to feature branch
82 lines
3.3 KiB
C++
82 lines
3.3 KiB
C++
// Copyright (C) 2018-2021 Intel Corporation
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
//
|
|
|
|
#include <gtest/gtest.h>
|
|
|
|
#include <ie_core.hpp>
|
|
#include <ie_ngraph_utils.hpp>
|
|
#include <ngraph/ngraph.hpp>
|
|
#include <shared_test_classes/base/layer_test_utils.hpp>
|
|
#include <vector>
|
|
|
|
#include "base_reference_test.hpp"
|
|
|
|
using namespace ngraph;
|
|
|
|
namespace reference_tests {
|
|
namespace {
|
|
|
|
struct AcoshParams {
|
|
Tensor input;
|
|
Tensor expected;
|
|
};
|
|
|
|
struct Builder : ParamsBuilder<AcoshParams> {
|
|
REFERENCE_TESTS_ADD_SET_PARAM(Builder, input);
|
|
REFERENCE_TESTS_ADD_SET_PARAM(Builder, expected);
|
|
};
|
|
|
|
class ReferenceAcoshLayerTest : public testing::TestWithParam<AcoshParams>, public CommonReferenceTest {
|
|
public:
|
|
void SetUp() override {
|
|
auto params = GetParam();
|
|
function = CreateFunction(params.input.shape, params.input.type);
|
|
inputData = {params.input.data};
|
|
refOutData = {params.expected.data};
|
|
}
|
|
static std::string getTestCaseName(const testing::TestParamInfo<AcoshParams>& obj) {
|
|
auto param = obj.param;
|
|
std::ostringstream result;
|
|
result << "shape=" << param.input.shape << "_";
|
|
result << "type=" << param.input.type;
|
|
return result.str();
|
|
}
|
|
|
|
private:
|
|
static std::shared_ptr<Function> CreateFunction(const Shape& shape, const element::Type& type) {
|
|
const auto in = std::make_shared<op::Parameter>(type, shape);
|
|
const auto acosh = std::make_shared<op::Acosh>(in);
|
|
return std::make_shared<Function>(NodeVector {acosh}, ParameterVector {in});
|
|
}
|
|
};
|
|
|
|
TEST_P(ReferenceAcoshLayerTest, AcoshWithHardcodedRefs) {
|
|
Exec();
|
|
}
|
|
|
|
} // namespace
|
|
|
|
INSTANTIATE_TEST_SUITE_P(
|
|
smoke_Acosh_With_Hardcoded_Refs, ReferenceAcoshLayerTest,
|
|
::testing::Values(Builder {}
|
|
.input({{8}, element::f16, std::vector<ngraph::float16> {1.f, 2.f, 3.f, 4.f, 5.f, 10.f, 100.f, 1000.f}})
|
|
.expected({{8}, element::f16, std::vector<ngraph::float16> {0., 1.317, 1.763, 2.063, 2.292, 2.993, 5.298, 7.6012}}),
|
|
Builder {}
|
|
.input({{8}, element::f32, std::vector<float> {1.f, 2.f, 3.f, 4.f, 5.f, 10.f, 100.f, 1000.f}})
|
|
.expected({{8}, element::f32, std::vector<float> {0., 1.317, 1.763, 2.063, 2.292, 2.993, 5.298, 7.6012}}),
|
|
Builder {}
|
|
.input({{8}, element::i32, std::vector<int32_t> {1, 2, 3, 4, 5, 10, 100, 1000}})
|
|
.expected({{8}, element::i32, std::vector<int32_t> {0, 1, 2, 2, 2, 3, 5, 8}}),
|
|
Builder {}
|
|
.input({{8}, element::i64, std::vector<int64_t> {1, 2, 3, 4, 5, 10, 100, 1000}})
|
|
.expected({{8}, element::i64, std::vector<int64_t> {0, 1, 2, 2, 2, 3, 5, 8}}),
|
|
Builder {}
|
|
.input({{8}, element::u32, std::vector<uint32_t> {1, 2, 3, 4, 5, 10, 100, 1000}})
|
|
.expected({{8}, element::u32, std::vector<uint32_t> {0, 1, 2, 2, 2, 3, 5, 8}}),
|
|
Builder {}
|
|
.input({{8}, element::u64, std::vector<uint64_t> {1, 2, 3, 4, 5, 10, 100, 1000}})
|
|
.expected({{8}, element::u64, std::vector<uint64_t> {0, 1, 2, 2, 2, 3, 5, 8}})),
|
|
ReferenceAcoshLayerTest::getTestCaseName);
|
|
} // namespace reference_tests
|