diff --git a/inference-engine/src/plaidml_plugin/ops/swish.cpp b/inference-engine/src/plaidml_plugin/ops/swish.cpp new file mode 100644 index 00000000000000..94aba056484b4c --- /dev/null +++ b/inference-engine/src/plaidml_plugin/ops/swish.cpp @@ -0,0 +1,25 @@ +// Copyright (C) 2020 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "plaidml_ops.hpp" + +#include "ngraph/opsets/opset.hpp" +#include "ngraph/opsets/opset4.hpp" + +#include "plaidml/op/op.h" + +using namespace plaidml; // NOLINT[build/namespaces] +using namespace InferenceEngine; // NOLINT[build/namespaces] + +namespace PlaidMLPlugin { + +static OpRegistration reg("swish", [](const Context& ctx) { + IE_ASSERT(ctx.operands.size() == 2); + auto I = ctx.operands.at(0); + auto beta = ctx.operands.at(1); + + return edsl::make_tuple(I / (1.0 + edsl::exp(-(beta * I)))); +}); + +} // namespace PlaidMLPlugin diff --git a/inference-engine/tests/functional/plugin/plaidml/shared_tests_instances/single_layer_tests/activation.cpp b/inference-engine/tests/functional/plugin/plaidml/shared_tests_instances/single_layer_tests/activation.cpp index ba3cb408756224..77c39fbb983433 100644 --- a/inference-engine/tests/functional/plugin/plaidml/shared_tests_instances/single_layer_tests/activation.cpp +++ b/inference-engine/tests/functional/plugin/plaidml/shared_tests_instances/single_layer_tests/activation.cpp @@ -40,6 +40,7 @@ const std::map>> activationTypes {HardSigmoid, {{0.2f, 0.5f}}}, {Selu, {{1.6732f, 1.0507f}}}, {Ceiling, {{}}}, + {Swish, {{1.0f}}} // {Mish, {{}}}, // {HSwish, {{}}}, // {SoftPlus, {{}}}