Caffe2 - C++ API
A deep learning, cross platform ML framework
stump_func_op.h
1 
18 #ifndef CAFFE2_FB_OPERATORS_UTILITY_OPS_H_
19 #define CAFFE2_FB_OPERATORS_UTILITY_OPS_H_
20 
21 #include "caffe2/core/context.h"
22 #include "caffe2/core/operator.h"
23 
24 namespace caffe2 {
25 
26 // Converts each input element into either high_ or low_value
27 // based on the given threshold.
28 //
29 // out[i] = low_value if in[i] <= threshold else high_value
30 template <typename TIN, typename TOUT, class Context>
31 class StumpFuncOp final : public Operator<Context> {
32  public:
33  USE_OPERATOR_CONTEXT_FUNCTIONS;
34 
35  StumpFuncOp(const OperatorDef& operator_def, Workspace* ws)
36  : Operator<Context>(operator_def, ws),
37  threshold_(OperatorBase::GetSingleArgument<TIN>("threshold", 0)),
38  low_value_(OperatorBase::GetSingleArgument<TOUT>("low_value", 0)),
39  high_value_(OperatorBase::GetSingleArgument<TOUT>("high_value", 0)) {}
40 
41  bool RunOnDevice() override;
42 
43  protected:
44  TIN threshold_;
45  TOUT low_value_;
46  TOUT high_value_;
47 
48  // Input: label, output: weight
49 };
50 
51 } // caffe2
52 
53 #endif // CAFFE2_FB_OPERATORS_UTILITY_OPS_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 ...