Caffe2 - C++ API
A deep learning, cross platform ML framework
relu_n_op.h
1 #ifndef CAFFE2_OPERATORS_RELU_N_OP_H_
2 #define CAFFE2_OPERATORS_RELU_N_OP_H_
3 
4 #include <vector>
5 
6 #include "caffe2/operators/elementwise_ops.h"
7 
8 namespace caffe2 {
9 
10 template <class Context>
11 struct ReluNFunctor {
12  explicit ReluNFunctor(OperatorBase& op)
13  : n(op.GetSingleArgument<float>("n", 6.0f)) {
14  CAFFE_ENFORCE_GT(n, 0, "n should be greater than 0");
15  }
16 
17  template <typename T>
18  bool operator()(const int N, const T* X, T* Y, Context* context) const;
19 
20  const float n;
21 };
22 
23 template <class Context>
26  : n(op.GetSingleArgument<float>("n", 6.0f)) {
27  CAFFE_ENFORCE_GT(n, 0, "n should be greater than 0");
28  }
29 
30  template <typename T>
31  bool Forward(
32  const std::vector<int>& Y_dims,
33  const std::vector<int>& dY_dims,
34  const T* Y,
35  const T* dY,
36  T* dX,
37  Context* context) const;
38 
39  const float n;
40 };
41 
42 } // namespace caffe2
43 
44 #endif // CAFFE2_OPERATORS_RELU_N_OP_H_
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...
Definition: blob.h:13