Caffe2 - C++ API
A deep learning, cross platform ML framework
roi_align_op.h
1 // Copyright 2004-present Facebook. All Rights Reserved.
2 
3 #ifndef ROI_ALIGN_OP_H_
4 #define ROI_ALIGN_OP_H_
5 
6 #include "caffe2/core/context.h"
7 #include "caffe2/core/logging.h"
8 #include "caffe2/core/operator.h"
9 
10 C10_DECLARE_CAFFE2_OPERATOR(RoIAlign)
11 
12 namespace caffe2 {
13 
14 template <typename T, class Context>
15 class RoIAlignOp final : public Operator<Context> {
16  public:
17  template <class... Args>
18  explicit RoIAlignOp(Args&&... args)
19  : Operator<Context>(std::forward<Args>(args)...),
20  order_(StringToStorageOrder(
21  this->template GetSingleArgument<string>("order", "NCHW"))),
22  spatial_scale_(
23  this->template GetSingleArgument<float>("spatial_scale", 1.)),
24  pooled_height_(this->template GetSingleArgument<int>("pooled_h", 1)),
25  pooled_width_(this->template GetSingleArgument<int>("pooled_w", 1)),
26  sampling_ratio_(
27  this->template GetSingleArgument<int>("sampling_ratio", -1)) {
28  DCHECK_GT(spatial_scale_, 0);
29  DCHECK_GT(pooled_height_, 0);
30  DCHECK_GT(pooled_width_, 0);
31  DCHECK_GE(sampling_ratio_, 0);
32  DCHECK(order_ == StorageOrder::NCHW || order_ == StorageOrder::NHWC);
33  }
34  USE_OPERATOR_CONTEXT_FUNCTIONS;
35 
36  bool RunOnDevice() override {
37  CAFFE_NOT_IMPLEMENTED;
38  }
39 
40  protected:
41  StorageOrder order_;
42  float spatial_scale_;
43  int pooled_height_;
44  int pooled_width_;
45  int sampling_ratio_;
46 };
47 
48 } // namespace caffe2
49 
50 #endif // ROI_ALIGN_OP_H_
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...
Definition: blob.h:13