Expression Templates Library (ETL)
relu_der_out.hpp
Go to the documentation of this file.
1 //=======================================================================
2 // Copyright (c) 2014-2023 Baptiste Wicht
3 // Distributed under the terms of the MIT License.
4 // (See accompanying file LICENSE or copy at
5 // http://opensource.org/licenses/MIT)
6 //=======================================================================
7 
13 #pragma once
14 
15 #ifdef ETL_EGBLAS_MODE
16 
17 #include "etl/impl/cublas/cuda.hpp"
18 
19 #include <egblas.hpp>
20 
21 #endif
22 
23 namespace etl::impl::egblas {
24 
28 #ifdef EGBLAS_HAS_SRELU_DER_OUT
29 static constexpr bool has_srelu_der_out = true;
30 #else
31 static constexpr bool has_srelu_der_out = false;
32 #endif
33 
43 inline void relu_der_out([[maybe_unused]] size_t n,
44  [[maybe_unused]] float alpha,
45  [[maybe_unused]] float* A,
46  [[maybe_unused]] size_t lda,
47  [[maybe_unused]] float* B,
48  [[maybe_unused]] size_t ldb) {
49 #ifdef EGBLAS_HAS_SRELU_DER_OUT
50  inc_counter("egblas");
51  egblas_srelu_der_out(n, alpha, A, lda, B, ldb);
52 #else
53  cpp_unreachable("Invalid call to egblas::relu_der_out");
54 #endif
55 }
56 
60 #ifdef EGBLAS_HAS_DRELU_DER_OUT
61 static constexpr bool has_drelu_der_out = true;
62 #else
63 static constexpr bool has_drelu_der_out = false;
64 #endif
65 
75 inline void relu_der_out([[maybe_unused]] size_t n,
76  [[maybe_unused]] double alpha,
77  [[maybe_unused]] double* A,
78  [[maybe_unused]] size_t lda,
79  [[maybe_unused]] double* B,
80  [[maybe_unused]] size_t ldb) {
81 #ifdef EGBLAS_HAS_DRELU_DER_OUT
82  inc_counter("egblas");
83  egblas_drelu_der_out(n, alpha, A, lda, B, ldb);
84 #else
85  cpp_unreachable("Invalid call to egblas::relu_der_out");
86 #endif
87 }
88 
89 } //end of namespace etl::impl::egblas
Definition: abs.hpp:23
void inc_counter([[maybe_unused]] const char *name)
Increase the given counter.
Definition: counters.hpp:25
void relu_der_out([[maybe_unused]] size_t n, [[maybe_unused]] float alpha, [[maybe_unused]] float *A, [[maybe_unused]] size_t lda, [[maybe_unused]] float *B, [[maybe_unused]] size_t ldb)
Wrappers for single-precision egblas relu_der_out operation.
Definition: relu_der_out.hpp:43