4 #include "caffe2/core/context.h" 5 #include "caffe2/core/logging.h" 6 #include "caffe2/core/operator.h" 7 #include "caffe2/utils/math.h" 11 template <
typename T,
class Context>
14 template <
class... Args>
18 this->
template GetSingleArgument<int>(OpSchema::Arg_IsTest, 0)),
19 order_(StringToStorageOrder(
20 this->
template GetSingleArgument<string>(
"order",
"NCHW"))),
21 pooled_height_(this->
template GetSingleArgument<int>(
"pooled_h", 1)),
22 pooled_width_(this->
template GetSingleArgument<int>(
"pooled_w", 1)),
24 this->
template GetSingleArgument<float>(
"spatial_scale", 1.)) {
26 (is_test_ && OutputSize() == 1) || (!is_test_ && OutputSize() == 2),
27 "Output size mismatch.");
28 CAFFE_ENFORCE_GT(spatial_scale_, 0);
29 CAFFE_ENFORCE_GT(pooled_height_, 0);
30 CAFFE_ENFORCE_GT(pooled_width_, 0);
32 order_, StorageOrder::NCHW,
"Only NCHW order is supported right now.");
34 USE_OPERATOR_CONTEXT_FUNCTIONS;
36 bool RunOnDevice()
override;
46 template <
typename T,
class Context>
49 template <
class... Args>
53 this->
template GetSingleArgument<float>(
"spatial_scale", 1.)),
54 pooled_height_(this->
template GetSingleArgument<int>(
"pooled_h", 1)),
55 pooled_width_(this->
template GetSingleArgument<int>(
"pooled_w", 1)),
56 order_(StringToStorageOrder(
57 this->
template GetSingleArgument<string>(
"order",
"NCHW"))) {
58 CAFFE_ENFORCE_GT(spatial_scale_, 0);
59 CAFFE_ENFORCE_GT(pooled_height_, 0);
60 CAFFE_ENFORCE_GT(pooled_width_, 0);
62 order_, StorageOrder::NCHW,
"Only NCHW order is supported right now.");
64 USE_OPERATOR_CONTEXT_FUNCTIONS;
66 bool RunOnDevice()
override {
67 CAFFE_NOT_IMPLEMENTED;
79 #endif // ROI_POOL_OP_H_
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...