2021-04-21 07:58:55 +02:00
|
|
|
// Copyright (C) 2021 Intel Corporation
|
|
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
#include "shared_test_classes/single_layer/activation.hpp"
|
|
|
|
|
#include "common_test_utils/test_constants.hpp"
|
|
|
|
|
|
|
|
|
|
using namespace LayerTestsDefinitions;
|
|
|
|
|
using namespace ngraph::helpers;
|
|
|
|
|
namespace {
|
|
|
|
|
TEST_P(ActivationLayerTest, Serialize) {
|
|
|
|
|
Serialize();
|
|
|
|
|
}
|
|
|
|
|
// Common params
|
|
|
|
|
const std::vector<InferenceEngine::Precision> inputPrecisions = {
|
|
|
|
|
InferenceEngine::Precision::FP32
|
|
|
|
|
// TODO: Fix Issue-27390
|
|
|
|
|
// InferenceEngine::Precision::I16,
|
|
|
|
|
// InferenceEngine::Precision::U8
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const std::vector<InferenceEngine::Precision> netPrecisions = {
|
|
|
|
|
InferenceEngine::Precision::FP32,
|
|
|
|
|
InferenceEngine::Precision::FP16
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const std::map<ActivationTypes, std::vector<std::vector<float>>> activationTypes = {
|
|
|
|
|
{Sigmoid, {}},
|
|
|
|
|
{Tanh, {}},
|
|
|
|
|
{Relu, {}},
|
|
|
|
|
{Exp, {}},
|
|
|
|
|
{Log, {}},
|
|
|
|
|
{Sign, {}},
|
|
|
|
|
{Abs, {}},
|
|
|
|
|
{Clamp, {{-2.0f, 2.0f}}},
|
|
|
|
|
{Negative, {}},
|
|
|
|
|
{Acos, {}},
|
2021-07-22 11:59:59 +02:00
|
|
|
{Acosh, {}},
|
2021-04-21 07:58:55 +02:00
|
|
|
{Asin, {}},
|
2021-07-08 12:18:09 +08:00
|
|
|
{Asinh, {}},
|
2021-04-21 07:58:55 +02:00
|
|
|
{Atan, {}},
|
2021-09-26 19:23:52 -07:00
|
|
|
{Atanh, {}},
|
2021-04-21 07:58:55 +02:00
|
|
|
{Cos, {}},
|
|
|
|
|
{Cosh, {}},
|
|
|
|
|
{Floor, {}},
|
|
|
|
|
{Sin, {}},
|
|
|
|
|
{Sinh, {}},
|
|
|
|
|
{Sqrt, {}},
|
|
|
|
|
{Tan, {}},
|
|
|
|
|
{Elu, {{0.1f}}},
|
|
|
|
|
{Erf, {}},
|
|
|
|
|
{HardSigmoid, {{0.2f, 0.5f}}},
|
|
|
|
|
{Selu, {{1.6732f, 1.0507f}}},
|
|
|
|
|
{Ceiling, {}},
|
|
|
|
|
{Mish, {}},
|
|
|
|
|
{HSwish, {}},
|
2021-06-23 15:50:52 +08:00
|
|
|
{Swish, {{0.3f}}},
|
2021-04-21 07:58:55 +02:00
|
|
|
{SoftPlus, {}},
|
|
|
|
|
{HSigmoid, {}},
|
|
|
|
|
{RoundHalfToEven, {}},
|
|
|
|
|
{RoundHalfAwayFromZero, {}},
|
|
|
|
|
{GeluErf, {}},
|
|
|
|
|
{GeluTanh, {}}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const std::map<ActivationTypes, std::vector<std::vector<float>>> activationParamTypes = {
|
|
|
|
|
{PReLu, {{-0.01f}}},
|
|
|
|
|
{LeakyRelu, {{0.01f}}}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
std::map<std::vector<size_t>, std::vector<std::vector<size_t>>> basic = {
|
|
|
|
|
{{1, 50}, {{}}},
|
|
|
|
|
{{1, 128}, {{}}},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
std::map<std::vector<size_t>, std::vector<std::vector<size_t>>> preluBasic = {
|
|
|
|
|
{{1, 50}, {{1}, {50}}},
|
|
|
|
|
{{1, 128}, {{1}, {128}}},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const auto basicCases = ::testing::Combine(
|
|
|
|
|
::testing::ValuesIn(CommonTestUtils::combineParams(activationTypes)),
|
|
|
|
|
::testing::ValuesIn(netPrecisions),
|
|
|
|
|
::testing::Values(InferenceEngine::Precision::UNSPECIFIED),
|
|
|
|
|
::testing::Values(InferenceEngine::Precision::UNSPECIFIED),
|
|
|
|
|
::testing::Values(InferenceEngine::Layout::ANY),
|
|
|
|
|
::testing::Values(InferenceEngine::Layout::ANY),
|
|
|
|
|
::testing::ValuesIn(CommonTestUtils::combineParams(basic)),
|
|
|
|
|
::testing::Values(CommonTestUtils::DEVICE_CPU)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const auto basicPreluCases = ::testing::Combine(
|
|
|
|
|
::testing::ValuesIn(CommonTestUtils::combineParams(activationParamTypes)),
|
|
|
|
|
::testing::ValuesIn(netPrecisions),
|
|
|
|
|
::testing::Values(InferenceEngine::Precision::UNSPECIFIED),
|
|
|
|
|
::testing::Values(InferenceEngine::Precision::UNSPECIFIED),
|
|
|
|
|
::testing::Values(InferenceEngine::Layout::ANY),
|
|
|
|
|
::testing::Values(InferenceEngine::Layout::ANY),
|
|
|
|
|
::testing::ValuesIn(CommonTestUtils::combineParams(preluBasic)),
|
|
|
|
|
::testing::Values(CommonTestUtils::DEVICE_CPU)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
2021-06-22 17:39:39 +03:00
|
|
|
INSTANTIATE_TEST_SUITE_P(smoke_Activation_Basic, ActivationLayerTest, basicCases, ActivationLayerTest::getTestCaseName);
|
|
|
|
|
INSTANTIATE_TEST_SUITE_P(smoke_Activation_Basic_Prelu, ActivationLayerTest, basicPreluCases, ActivationLayerTest::getTestCaseName);
|
2021-04-21 07:58:55 +02:00
|
|
|
|
2021-06-22 17:39:39 +03:00
|
|
|
INSTANTIATE_TEST_SUITE_P(smoke_Activation_Basic, ActivationParamLayerTest, basicPreluCases, ActivationLayerTest::getTestCaseName);
|
2021-04-21 07:58:55 +02:00
|
|
|
|
2021-06-22 17:39:39 +03:00
|
|
|
INSTANTIATE_TEST_SUITE_P(smoke_Activation_Basic, ActivationDynamicLayerTest, basicCases, ActivationLayerTest::getTestCaseName);
|
2021-04-21 07:58:55 +02:00
|
|
|
|
|
|
|
|
} // namespace
|