28 template <vector_mode_t V>
35 static constexpr
bool gpu_computable = is_floating_t<T>&& impl::egblas::has_srelu_der_out&& impl::egblas::has_drelu_der_out;
48 template <
typename V = default_vec>
57 return x > T(0) ? T(1) : T(0);
66 template <
typename V = default_vec>
68 return V::round_up(
V::min(V::set(T(1)), x));
78 template <
typename X,
typename Y>
85 impl::egblas::relu_der_out(
etl::size(y), alpha, t1.gpu_memory(), 1, t2.gpu_memory(), 1);
95 template <
typename X,
typename Y>
100 impl::egblas::relu_der_out(
etl::size(y), alpha, t1.gpu_memory(), 1, y.gpu_memory(), 1);
112 static std::string
desc() noexcept {
113 return "relu_derivative";
static T apply(const T &x)
Apply the unary operator on x.
Definition: relu_derivative.hpp:56
static constexpr bool gpu_computable
Indicates if the operator can be computed on GPU.
Definition: relu_derivative.hpp:35
decltype(auto) select_smart_gpu_compute(X &x, Y &y)
Compute the expression into a representation that is GPU up to date and possibly store this represent...
Definition: helpers.hpp:434
static constexpr bool linear
Indicates if the operator is linear.
Definition: relu_derivative.hpp:20
static auto gpu_compute_hint(const X &x, Y &y) noexcept
Compute the result of the operation using the GPU.
Definition: relu_derivative.hpp:79
static Y & gpu_compute(const X &x, Y &y) noexcept
Compute the result of the operation using the GPU.
Definition: relu_derivative.hpp:96
Root namespace for the ETL library.
Definition: adapter.hpp:15
static constexpr bool thread_safe
Indicates if the operator is thread safe or not.
Definition: relu_derivative.hpp:21
Unary operation computing the derivate of the RELU operation.
Definition: relu_derivative.hpp:19
static constexpr int complexity()
Estimate the complexity of operator.
Definition: relu_derivative.hpp:41
typename V::template vec_type< T > vec_type
Definition: relu_derivative.hpp:49
auto min(L &&lhs, R &&rhs)
Create an expression with the min value of lhs or rhs.
Definition: expression_builder.hpp:77
decltype(auto) force_temporary_gpu_dim_only(E &&expr)
Force a temporary out of the expression, without copying its content.
Definition: temporary.hpp:223
static constexpr bool vectorizable
Indicates if the expression is vectorizable using the given vector mode.
Definition: relu_derivative.hpp:29
constexpr size_t size(const E &expr) noexcept
Returns the size of the given ETL expression.
Definition: helpers.hpp:108
static std::string desc() noexcept
Returns a textual representation of the operator.
Definition: relu_derivative.hpp:112
decltype(auto) smart_gpu_compute_hint(E &expr, Y &y)
Compute the expression into a representation that is GPU up to date.
Definition: helpers.hpp:368
static vec_type< V > load(const vec_type< V > &x) noexcept
Compute several applications of the operator at a time.
Definition: relu_derivative.hpp:67
EGBLAS wrappers for the relu_der_out operation.