Caffe2 - C++ API
A deep learning, cross platform ML framework
elementwise_linear_op.h
1 #ifndef CAFFE2_OPERATORS_ELEMENTWISE_LINEAR_OP_H_
2 #define CAFFE2_OPERATORS_ELEMENTWISE_LINEAR_OP_H_
3 
4 #include "caffe2/core/context.h"
5 #include "caffe2/core/operator.h"
6 #include "caffe2/utils/math.h"
7 
8 namespace caffe2 {
9 template <typename T, class Context, class Engine = DefaultEngine>
10 class ElementwiseLinearOp final : public Operator<Context> {
11  public:
12  ElementwiseLinearOp(const OperatorDef& operator_def, Workspace* ws)
13  : Operator<Context>(operator_def, ws),
14  axis_(OperatorBase::GetSingleArgument<int>("axis", 1)) {}
15 
16  USE_OPERATOR_CONTEXT_FUNCTIONS;
17  bool RunOnDevice() override;
18 
19  protected:
20  int axis_;
21 };
22 
23 template <typename T, class Context, class Engine = DefaultEngine>
24 class ElementwiseLinearGradientOp final : public Operator<Context> {
25  public:
26  ElementwiseLinearGradientOp(const OperatorDef& operator_def, Workspace* ws)
27  : Operator<Context>(operator_def, ws),
28  axis_(OperatorBase::GetSingleArgument<int>("axis", 1)) {}
29 
30  USE_OPERATOR_CONTEXT_FUNCTIONS;
31  bool RunOnDevice() override;
32 
33  protected:
34  int axis_;
35 };
36 
37 } // namespace caffe2
38 
39 #endif // CAFFE2_OPERATORS_ELEMENTWISE_LINEAR_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 ...