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  ThresholdedReluOp(const OperatorDef& operator_def, Workspace* ws)
16  : Operator<Context>(operator_def, ws) {
17  alpha_ = OperatorBase::GetSingleArgument<T>("alpha", 1.0);
18  }
19 
20  bool RunOnDevice() override;
21 
22  protected:
23  T alpha_;
24 };
25 
26 template <typename T, class Context>
27 class ThresholdedReluGradientOp final : public Operator<Context> {
28  public:
29  USE_OPERATOR_CONTEXT_FUNCTIONS;
30  ThresholdedReluGradientOp(const OperatorDef& operator_def, Workspace* ws)
31  : Operator<Context>(operator_def, ws) {
32  alpha_ = OperatorBase::GetSingleArgument<T>("alpha", 1.0);
33  }
34 
35  bool RunOnDevice() override;
36 
37  protected:
38  T alpha_;
39 };
40 
41 } // namespace caffe2
42 
43 #endif // CAFFE2_OPERATORS_THRESHOLDED_RELU_OP_H_
Workspace is a class that holds all the related objects created during runtime: (1) all blobs...
Definition: workspace.h:47
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...