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  template <class... Args>
13  explicit ElementwiseLinearOp(Args&&... args)
14  : Operator<Context>(std::forward<Args>(args)...),
15  axis_(this->template GetSingleArgument<int>("axis", 1)) {}
16 
17  USE_OPERATOR_CONTEXT_FUNCTIONS;
18  bool RunOnDevice() override;
19 
20  protected:
21  int axis_;
22 };
23 
24 template <typename T, class Context, class Engine = DefaultEngine>
25 class ElementwiseLinearGradientOp final : public Operator<Context> {
26  public:
27  template <class... Args>
28  explicit ElementwiseLinearGradientOp(Args&&... args)
29  : Operator<Context>(std::forward<Args>(args)...),
30  axis_(this->template GetSingleArgument<int>("axis", 1)) {}
31 
32  USE_OPERATOR_CONTEXT_FUNCTIONS;
33  bool RunOnDevice() override;
34 
35  protected:
36  int axis_;
37 };
38 
39 } // namespace caffe2
40 
41 #endif // CAFFE2_OPERATORS_ELEMENTWISE_LINEAR_OP_H_
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...
Definition: blob.h:13