10 #include "ngraph/except.hpp"
11 #include "ngraph/node.hpp"
16 #pragma warning(disable : 4100)
21 #if (defined(__GNUC__) && !defined(__clang__))
22 #undef NG_ATTRIBUTE_UNUSED
23 #define NG_ATTRIBUTE_UNUSED __attribute__((__unused__))
25 #define NG_ATTRIBUTE_UNUSED
28 #define UNUSED_PARAMETER NG_ATTRIBUTE_UNUSED = 0
41 :
ngraph_error{
"Unknown activation function: " + func_name}
49 std::shared_ptr<Node> sigmoid(
const std::shared_ptr<Node>& arg,
50 float alpha UNUSED_PARAMETER,
51 float beta UNUSED_PARAMETER);
52 std::shared_ptr<Node> tanh(
const std::shared_ptr<Node>& arg,
53 float alpha UNUSED_PARAMETER,
54 float beta UNUSED_PARAMETER);
55 std::shared_ptr<Node> relu(
const std::shared_ptr<Node>& arg,
56 float alpha UNUSED_PARAMETER,
57 float beta UNUSED_PARAMETER);
59 hardsigmoid(
const std::shared_ptr<Node>& arg,
float alpha,
float beta);
62 using ActivationFunctionType = std::shared_ptr<Node> (*)(
const std::shared_ptr<Node>&,
80 std::shared_ptr<Node>
operator()(
const std::shared_ptr<Node>& arg)
const;
82 void set_alpha(
float alpha) { m_alpha = alpha; }
83 void set_beta(
float beta) { m_beta = beta; }
87 ActivationFunctionType m_function;
102 ActivationFunction get_activation_func_by_name(
const std::string& func_name);
113 #ifdef UNUSED_PARAMETER
114 #undef UNUSED_PARAMETER
116 #ifdef NG_ATTRIBUTE_UNUSED
117 #undef NG_ATTRIBUTE_UNUSED
Base error for ngraph runtime errors.
Definition: except.hpp:16
Class representing activation function used in RNN cells.
Definition: activation_functions.hpp:70
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:16
Definition: activation_functions.hpp:39