4 #include "caffe2/core/context.h" 5 #include "caffe2/core/operator.h" 9 template <
typename T,
class Context>
12 template <
class... Args>
17 order_(StringToStorageOrder(
18 this->
template GetSingleArgument<std::string>(
"order",
"NCHW"))) {
20 width_scale_ =
static_cast<T>(
21 this->
template GetSingleArgument<float>(
"width_scale", 1));
24 height_scale_ =
static_cast<T>(
25 this->
template GetSingleArgument<float>(
"height_scale", 1));
28 CAFFE_ENFORCE_GT(width_scale_, 0);
29 CAFFE_ENFORCE_GT(height_scale_, 0);
31 CAFFE_ENFORCE(order_ == StorageOrder::NCHW || order_ == StorageOrder::NHWC);
34 USE_OPERATOR_CONTEXT_FUNCTIONS;
36 bool RunOnDevice()
override;
37 bool RunOnDeviceWithOrderNCHW();
38 bool RunOnDeviceWithOrderNHWC();
46 template <
typename T,
class Context>
49 template <
class... Args>
54 order_(StringToStorageOrder(
55 this->
template GetSingleArgument<std::string>(
"order",
"NCHW"))) {
56 width_scale_ =
static_cast<T>(
57 this->
template GetSingleArgument<float>(
"width_scale", 1));
58 height_scale_ =
static_cast<T>(
59 this->
template GetSingleArgument<float>(
"height_scale", 1));
61 CAFFE_ENFORCE_GT(width_scale_, 0);
62 CAFFE_ENFORCE_GT(height_scale_, 0);
64 CAFFE_ENFORCE(order_ == StorageOrder::NCHW || order_ == StorageOrder::NHWC);
67 USE_OPERATOR_CONTEXT_FUNCTIONS;
69 bool RunOnDevice()
override;
70 bool RunOnDeviceWithOrderNCHW();
71 bool RunOnDeviceWithOrderNHWC();
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...
bool HasArgument(const string &name) const
Checks if the operator has an argument of the given name.