Caffe2 - C++ API
A deep learning, cross platform ML framework
sparse_normalize_op.h
1 #pragma once
2 
3 #include "caffe2/core/operator.h"
4 #include "caffe2/utils/math.h"
5 
6 namespace caffe2 {
7 
8 template <typename T, class Context>
9 class CAFFE2_API SparseNormalizeOp final : public Operator<Context> {
10  public:
11  USE_OPERATOR_CONTEXT_FUNCTIONS;
12  template <class... Args>
13  explicit SparseNormalizeOp(Args&&... args)
14  : Operator<Context>(std::forward<Args>(args)...),
15  use_max_norm_(
16  this->template GetSingleArgument<bool>("use_max_norm", true)),
17  norm_(this->template GetSingleArgument<float>("norm", 1.0)) {
18  CAFFE_ENFORCE_GE(norm_, 0, "norm should be bigger than 0");
19  }
20 
21  bool RunOnDevice() override;
22 
23  template <typename SIndex>
24  bool DoRunWithType();
25 
26  protected:
27  bool use_max_norm_;
28  float norm_;
29  INPUT_TAGS(PARAM, INDICES, GRAD);
30  OUTPUT_TAGS(OUTPUT_PARAM);
31 };
32 
33 } // namespace caffe2
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...
Definition: blob.h:13