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 namespace caffe2 {
11 
12 template <typename T, class Context>
13 class RoIAlignOp final : public Operator<Context> {
14  public:
15  RoIAlignOp(const OperatorDef& operator_def, Workspace* ws)
16  : Operator<Context>(operator_def, ws),
17  order_(StringToStorageOrder(
18  OperatorBase::GetSingleArgument<string>("order", "NCHW"))),
19  spatial_scale_(
20  OperatorBase::GetSingleArgument<float>("spatial_scale", 1.)),
21  pooled_height_(OperatorBase::GetSingleArgument<int>("pooled_h", 1)),
22  pooled_width_(OperatorBase::GetSingleArgument<int>("pooled_w", 1)),
23  sampling_ratio_(
24  OperatorBase::GetSingleArgument<int>("sampling_ratio", -1)) {
25  DCHECK_GT(spatial_scale_, 0);
26  DCHECK_GT(pooled_height_, 0);
27  DCHECK_GT(pooled_width_, 0);
28  DCHECK_GE(sampling_ratio_, 0);
29  DCHECK(order_ == StorageOrder::NCHW || order_ == StorageOrder::NHWC);
30  }
31  USE_OPERATOR_CONTEXT_FUNCTIONS;
32 
33  bool RunOnDevice() override {
34  CAFFE_NOT_IMPLEMENTED;
35  }
36 
37  protected:
38  StorageOrder order_;
39  float spatial_scale_;
40  int pooled_height_;
41  int pooled_width_;
42  int sampling_ratio_;
43 };
44 
45 } // namespace caffe2
46 
47 #endif // ROI_ALIGN_OP_H_
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 ...