22 #include "ngraph/except.hpp"
23 #include "ngraph/node.hpp"
28 #pragma warning(disable : 4100)
33 #if (defined(__GNUC__) && !defined(__clang__))
34 #undef NG_ATTRIBUTE_UNUSED
35 #define NG_ATTRIBUTE_UNUSED __attribute__((__unused__))
37 #define NG_ATTRIBUTE_UNUSED
40 #define UNUSED_PARAMETER NG_ATTRIBUTE_UNUSED = 0
53 :
ngraph_error{
"Unknown activation function: " + func_name}
61 std::shared_ptr<Node> sigmoid(
const std::shared_ptr<Node>& arg,
62 float alpha UNUSED_PARAMETER,
63 float beta UNUSED_PARAMETER);
64 std::shared_ptr<Node> tanh(
const std::shared_ptr<Node>& arg,
65 float alpha UNUSED_PARAMETER,
66 float beta UNUSED_PARAMETER);
67 std::shared_ptr<Node> relu(
const std::shared_ptr<Node>& arg,
68 float alpha UNUSED_PARAMETER,
69 float beta UNUSED_PARAMETER);
71 hardsigmoid(
const std::shared_ptr<Node>& arg,
float alpha,
float beta);
74 using ActivationFunctionType = std::shared_ptr<Node> (*)(
const std::shared_ptr<Node>&,
92 std::shared_ptr<Node>
operator()(
const std::shared_ptr<Node>& arg)
const;
94 void set_alpha(
float alpha) { m_alpha = alpha; }
95 void set_beta(
float beta) { m_beta = beta; }
98 ActivationFunctionType m_function;
113 ActivationFunction get_activation_func_by_name(
const std::string& func_name);
124 #ifdef UNUSED_PARAMETER
125 #undef UNUSED_PARAMETER
127 #ifdef NG_ATTRIBUTE_UNUSED
128 #undef NG_ATTRIBUTE_UNUSED
Base error for ngraph runtime errors.
Definition: except.hpp:28
Class representing activation function used in RNN cells.
Definition: activation_functions.hpp:82
std::shared_ptr< Node > operator()(const std::shared_ptr< Node > &arg) const
Calls stored activation function with provided node argument.
The Intel nGraph C++ API.
Definition: attribute_adapter.hpp:28
Definition: activation_functions.hpp:51