Caffe2 - C++ API
A deep learning, cross platform ML framework
percentile_op.h
1 // Operator to calculate percentile values for an input tensor of data,
2 // given samples of data from the same distribution, labeled with their
3 // percentile values.
4 
5 #ifndef CAFFE2_OPERATORS_PERCENTILE_OP_H_
6 #define CAFFE2_OPERATORS_PERCENTILE_OP_H_
7 
8 #include "caffe2/core/context.h"
9 #include "caffe2/core/logging.h"
10 #include "caffe2/core/operator.h"
11 #include "caffe2/core/tensor.h"
12 #include "caffe2/utils/math.h"
13 
14 namespace caffe2 {
15 
16 template <class Context>
17 class PercentileOp final : public Operator<Context> {
18  public:
19  USE_OPERATOR_CONTEXT_FUNCTIONS;
20  PercentileOp(const OperatorDef& operator_def, Workspace* ws)
21  : Operator<Context>(operator_def, ws) {}
22 
23  bool RunOnDevice() override;
24 
25  protected:
26  INPUT_TAGS(X, VAL_PCT_PAIRS, LENS);
27  OUTPUT_TAGS(PCT);
28  Tensor<Context> values_tensor;
29  Tensor<Context> percentiles_tensor;
30 };
31 
32 } // namespace caffe2
33 
34 #endif // CAFFE2_OPERATORS_PERCENTILE_OP_H_
Tensor is the basic class in Caffe2 that stores a contiguous memory with its shape information...
Definition: tensor.h:93
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 ...