Caffe2 - C++ API
A deep learning, cross platform ML framework
weighted_sample_op.h
1 // Copyright 2004-present Facebook. All Rights Reserved.
2 
3 #ifndef CAFFE2_OPERATORS_WEIGHTEDSAMPLE_OP_H_
4 #define CAFFE2_OPERATORS_WEIGHTEDSAMPLE_OP_H_
5 
6 #include "caffe2/core/context.h"
7 #include "caffe2/core/operator.h"
8 #include "caffe2/core/tensor.h"
9 #include "caffe2/utils/math.h"
10 
11 namespace caffe2 {
12 
13 template <typename T, class Context>
14 class WeightedSampleOp final : public Operator<Context> {
15  public:
16  WeightedSampleOp(const OperatorDef& operator_def, Workspace* ws)
17  : Operator<Context>(operator_def, ws) {}
18 
19  USE_OPERATOR_CONTEXT_FUNCTIONS;
20 
21  bool RunOnDevice() override;
22 
23  private:
24  vector<float> cum_mass_;
25  Tensor<Context> unif_samples_;
26 };
27 
28 } // namespace caffe2
29 
30 #endif // CAFFE2_OPERATORS_WEIGHTEDSAMPLE_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 ...