Caffe2 - C++ API
A deep learning, cross platform ML framework
logit_op.h
1 #ifndef CAFFE2_OPERATORS_LOGIT_OP_H_
2 #define CAFFE2_OPERATORS_LOGIT_OP_H_
3 
4 #include "caffe2/core/context.h"
5 #include "caffe2/core/operator.h"
6 #include "caffe2/operators/elementwise_ops.h"
7 
8 namespace caffe2 {
9 
10 template <class Context>
11 struct LogitFunctor {
12  explicit LogitFunctor(OperatorBase& op)
13  : eps_(op.GetSingleArgument<float>("eps", 1e-6f)) {
14  CAFFE_ENFORCE_GT(eps_, 0.0);
15  CAFFE_ENFORCE_LT(eps_, 0.5);
16  }
17 
18  template <typename T>
19  bool operator()(const int size, const T* X, T* Y, Context* context) const;
20 
21  const float eps_;
22 };
23 
24 template <typename T, class Context>
25 class LogitGradientOp final : public Operator<Context> {
26  public:
27  USE_OPERATOR_CONTEXT_FUNCTIONS;
28  template <class... Args>
29  explicit LogitGradientOp(Args&&... args)
30  : Operator<Context>(std::forward<Args>(args)...),
31  eps_(this->template GetSingleArgument<float>("eps", 1e-6f)) {}
32  ~LogitGradientOp() {}
33 
34  bool RunOnDevice() override;
35 
36  protected:
37  float eps_;
38 };
39 
40 } // namespace caffe2
41 
42 #endif // CAFFE2_OPERATORS_LOGIT_OP_H_
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...
Definition: blob.h:13