MagmaDNN  1.0
c++NeuralNetworkFramework
tanhop.h
Go to the documentation of this file.
1 
9 #pragma once
10 #include <string>
11 #include "compute/operation.h"
12 #include "tanh_internal.h"
13 
14 namespace magmadnn {
15 namespace op {
16 
20 template <typename T>
21 class TanhOp : public Operation<T> {
22 public:
23  TanhOp(Operation<T> *x, bool copy=true);
24 
25  std::string to_string() { return "TANH( " + x->to_string() + " )"; }
26 
27 protected:
28  Tensor<T> *_eval(bool recompute=true);
30 
31  Operation<T> *x;
32  Tensor<T> *x_tensor;
33 
34  bool copy;
35 };
36 
43 template <typename T>
44 TanhOp<T>* tanh(Operation<T> *x, bool copy=true);
45 
46 } // namespace op
47 } // namespace magmadnn
Tensor< T > * _grad(Operation< T > *consumer, Operation< T > *var, Tensor< T > *grad)
Definition: tanhop.cpp:35
Definition: addop.cpp:11
Tensor< T > * _eval(bool recompute=true)
Definition: tanhop.cpp:25
Definition: tensor.h:34
TanhOp< T > * tanh(Operation< T > *x, bool copy)
Definition: tanhop.cpp:43
std::string to_string()
Definition: tanhop.h:25
Definition: tanhop.h:21
virtual Tensor< T > * grad(Operation< T > *consumer, Operation< T > *var, Tensor< T > *grad, bool recompute=true)
Definition: operation.h:93
virtual std::string to_string()=0
Definition: operation.h:18
Variable< T > * var(std::string name, Tensor< T > *val)
Definition: variable.cpp:73