103 template <etl_expr E>
113 template <etl_expr E>
123 template <etl_expr E>
133 template <etl_expr E>
143 template <etl_expr E>
153 template <etl_expr E>
163 template <etl_expr E>
173 template <
typename E>
175 return std::forward<E>(value);
183 template <
typename E>
196 template <etl_expr E>
206 template <etl_expr E>
216 template <etl_expr E>
229 template <etl_expr E>
242 template <etl_expr E>
244 return etl::clip(x * 0.2 + 0.5, 0.0, 1.0);
252 template <etl_expr E>
254 if constexpr (etl::is_1d<E>) {
267 template <etl_expr E>
269 if constexpr (etl::is_1d<E>) {
282 template <
typename E>
292 template <etl_expr E>
302 template <etl_expr E>
312 template <
typename E,
typename G>
314 return detail::make_stateful_unary_expr<E, bernoulli_unary_g_op<G, value_t<E>>>(value, g);
322 template <etl_expr E>
324 return detail::make_stateful_unary_expr<E, state_bernoulli_unary_op<value_t<E>>>(value);
332 template <etl_expr E>
334 return detail::make_stateful_unary_expr<E, state_bernoulli_unary_op<value_t<E>>>(value, states);
342 template <etl_expr E,
typename G>
344 return detail::make_stateful_unary_expr<E, state_bernoulli_unary_g_op<G, value_t<E>>>(value, g);
352 template <etl_expr E,
typename G>
354 return detail::make_stateful_unary_expr<E, state_bernoulli_unary_g_op<G, value_t<E>>>(value, g, states);
362 template <etl_expr E>
372 template <etl_expr E,
typename G>
374 return detail::make_stateful_unary_expr<E, reverse_bernoulli_unary_g_op<G, value_t<E>>>(value, g);
382 template <etl_expr E>
384 return 1.0 - (
tanh(value) >>
tanh(value));
392 template <etl_expr E>
auto sin(E &&value) -> detail::unary_helper< E, sin_unary_op >
Apply sinus on each value of the given expression.
Definition: function_expression_builder.hpp:114
auto sinh(E &&value) -> detail::unary_helper< E, sinh_unary_op >
Apply hyperbolic sinus on each value of the given expression.
Definition: function_expression_builder.hpp:144
auto max(L &&lhs, R &&rhs)
Create an expression with the max value of lhs or rhs.
Definition: expression_builder.hpp:65
auto state_bernoulli(const E &value)
Apply Bernoulli sampling to the values of the expression.
Definition: function_expression_builder.hpp:323
auto tanh_derivative(E &&value) -> decltype(1.0 -(tanh(value) >> tanh(value)))
Return the derivative of the tanh function of the given ETL expression.
Definition: function_expression_builder.hpp:383
auto hard_sigmoid(E &&x) -> decltype(etl::clip(x *0.2+0.5, 0.0, 1.0))
Return an hard approximation of the logistic sigmoid of the given ETL expression. ...
Definition: function_expression_builder.hpp:243
auto log2(E &&value) -> detail::unary_helper< E, log2_unary_op >
Apply logarithm (base 2) on each value of the given expression.
Definition: function_expression_builder.hpp:74
auto sqrt(E &&value) -> detail::unary_helper< E, sqrt_unary_op >
Apply square root on each value of the given expression.
Definition: function_expression_builder.hpp:24
auto softmax(E &&e)
Return the softmax function of the given ETL expression.
Definition: function_expression_builder.hpp:253
auto relu(const E &value) -> detail::unary_helper< E, relu_unary_op >
Return the relu activation of the given ETL expression.
Definition: function_expression_builder.hpp:207
auto cosh(E &&value) -> detail::unary_helper< E, cosh_unary_op >
Apply hyperbolic cosinus on each value of the given expression.
Definition: function_expression_builder.hpp:134
auto cbrt(E &&value) -> detail::unary_helper< E, cbrt_unary_op >
Apply cubic root on each value of the given expression.
Definition: function_expression_builder.hpp:44
auto bernoulli(const E &value) -> detail::unary_helper< E, bernoulli_unary_op >
Apply Bernoulli sampling to the values of the expression.
Definition: function_expression_builder.hpp:303
auto sigmoid(const E &value) -> detail::unary_helper< E, sigmoid_unary_op >
Return the logistic sigmoid of the given ETL expression.
Definition: function_expression_builder.hpp:197
An unary expression.
Definition: unary_expr.hpp:126
auto cos(E &&value) -> detail::unary_helper< E, cos_unary_op >
Apply cosinus on each value of the given expression.
Definition: function_expression_builder.hpp:104
Root namespace for the ETL library.
Definition: adapter.hpp:15
auto tanh(E &&value) -> detail::unary_helper< E, tanh_unary_op >
Apply hyperbolic tangent on each value of the given expression.
Definition: function_expression_builder.hpp:124
auto softmax_derivative([[maybe_unused]] E &&e)
Return the derivative of the softmax function of the given ETL expression.
Definition: function_expression_builder.hpp:283
auto relu_derivative(const E &value) -> detail::unary_helper< E, relu_derivative_op >
Return the derivative of the relu function of the given ETL expression.
Definition: function_expression_builder.hpp:393
auto invcbrt(E &&value) -> detail::unary_helper< E, invcbrt_unary_op >
Apply inverse cubic root on each value of the given expression.
Definition: function_expression_builder.hpp:54
auto log10(E &&value) -> detail::unary_helper< E, log10_unary_op >
Apply logarithm (base 10) on each value of the given expression.
Definition: function_expression_builder.hpp:84
auto tan(E &&value) -> detail::unary_helper< E, tan_unary_op >
Apply tangent on each value of the given expression.
Definition: function_expression_builder.hpp:94
auto fast_sigmoid(const E &value) -> detail::unary_helper< E, fast_sigmoid_unary_op >
Return a fast approximation of the logistic sigmoid of the given ETL expression.
Definition: function_expression_builder.hpp:230
auto softplus(E &&value) -> detail::unary_helper< E, softplus_unary_op >
Return the softplus of the given ETL expression.
Definition: function_expression_builder.hpp:293
value_t< E > sum(E &&values)
Returns the sum of all the values contained in the given expression.
Definition: expression_builder.hpp:624
auto exp(E &&value) -> detail::unary_helper< E, exp_unary_op >
Apply exponential on each value of the given expression.
Definition: function_expression_builder.hpp:154
auto stable_softmax(E &&e)
Returns the softmax function of the given ETL expression. This version is implemented so that numeric...
Definition: function_expression_builder.hpp:268
auto r_bernoulli(const E &value) -> detail::unary_helper< E, reverse_bernoulli_unary_op >
Apply Reverse Bernoulli sampling to the values of the expression.
Definition: function_expression_builder.hpp:363
auto sign(E &&value) -> detail::unary_helper< E, sign_unary_op >
Apply sign on each value of the given expression.
Definition: function_expression_builder.hpp:164
auto identity_derivative([[maybe_unused]] E &&value)
Return the derivative of the identiy function for the given value.
Definition: function_expression_builder.hpp:184
decltype(auto) identity(E &&value)
Performs the identiy function on the ETL expression.
Definition: function_expression_builder.hpp:174
A batch softmax function expression.
Definition: batch_softmax_expr.hpp:20
auto sigmoid_derivative(E &&value) -> decltype(sigmoid(value) >>(1.0 - sigmoid(value)))
Return the derivative of the logistic sigmoid of the given ETL expression.
Definition: function_expression_builder.hpp:217
auto log(E &&value) -> detail::unary_helper< E, log_unary_op >
Apply logarithm (base e) on each value of the given expression.
Definition: function_expression_builder.hpp:64
auto invsqrt(E &&value) -> detail::unary_helper< E, invsqrt_unary_op >
Apply inverse square root on each value of the given expression.
Definition: function_expression_builder.hpp:34
auto clip(E &&value, T min, T max)
Clip each values of the ETL expression between min and max.
Definition: expression_builder.hpp:110