Caffe2 - C++ API
A deep learning, cross platform ML framework
thresholded_relu_op.h
1 #ifndef CAFFE2_OPERATORS_THRESHOLDED_RELU_OP_H_
2 #define CAFFE2_OPERATORS_THRESHOLDED_RELU_OP_H_
3 
4 #include "caffe2/core/common_omp.h"
5 #include "caffe2/core/context.h"
6 #include "caffe2/core/logging.h"
7 #include "caffe2/core/operator.h"
8 
9 namespace caffe2 {
10 
11 template <typename T, class Context>
12 class ThresholdedReluOp final : public Operator<Context> {
13  public:
14  USE_OPERATOR_CONTEXT_FUNCTIONS;
15  template <class... Args>
16  explicit ThresholdedReluOp(Args&&... args)
17  : Operator<Context>(std::forward<Args>(args)...) {
18  alpha_ = this->template GetSingleArgument<T>("alpha", 1.0);
19  }
20 
21  bool RunOnDevice() override;
22 
23  protected:
24  T alpha_;
25 };
26 
27 template <typename T, class Context>
29  public:
30  USE_OPERATOR_CONTEXT_FUNCTIONS;
31  template <class... Args>
32  explicit ThresholdedReluGradientOp(Args&&... args)
33  : Operator<Context>(std::forward<Args>(args)...) {
34  alpha_ = this->template GetSingleArgument<T>("alpha", 1.0);
35  }
36 
37  bool RunOnDevice() override;
38 
39  protected:
40  T alpha_;
41 };
42 
43 } // namespace caffe2
44 
45 #endif // CAFFE2_OPERATORS_THRESHOLDED_RELU_OP_H_
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...
Definition: blob.h:13