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  template <class... Args>
17  explicit WeightedSampleOp(Args&&... args)
18  : Operator<Context>(std::forward<Args>(args)...) {}
19 
20  USE_OPERATOR_CONTEXT_FUNCTIONS;
21 
22  bool RunOnDevice() override;
23 
24  private:
25  vector<float> cum_mass_;
26  Tensor unif_samples_;
27 };
28 
29 } // namespace caffe2
30 
31 #endif // CAFFE2_OPERATORS_WEIGHTEDSAMPLE_OP_H_
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...
Definition: blob.h:13