MagmaDNN  1.0
c++NeuralNetworkFramework
relu.h
Go to the documentation of this file.
1 
9 #pragma once
10 
11 #include "tensor/tensor.h"
12 #include "utilities_internal.h"
13 
14 #if defined(_HAS_CUDA_)
15 #include "cudnn.h"
16 #endif
17 
18 namespace magmadnn {
19 namespace math {
20 
21 template <typename T>
22 void relu(Tensor<T> *x, Tensor<T> *out);
23 
24 template <typename T>
25 void relu_grad(Tensor<T> *x, Tensor<T> *relu_out, Tensor<T> *grad, Tensor<T> *out);
26 
27 #if defined(_HAS_CUDA_)
28 
29 struct relu_cudnn_settings_t {
30  cudnnActivationDescriptor_t descriptor;
31 };
32 
33 template <typename T>
34 void relu_device(Tensor<T> *x, Tensor<T> *out, relu_cudnn_settings_t settings);
35 
36 template <typename T>
37 void relu_grad_device(Tensor<T> *x, Tensor<T> *relu_out, Tensor<T> *grad, Tensor<T> *out, relu_cudnn_settings_t settings);
38 #endif
39 
40 }
41 }
Definition: addop.cpp:11