1 #ifndef CAFFE2_OPERATORS_PAD_OP_H_ 2 #define CAFFE2_OPERATORS_PAD_OP_H_ 4 #include "caffe2/core/context.h" 5 #include "caffe2/core/logging.h" 6 #include "caffe2/core/operator.h" 7 #include "caffe2/operators/conv_pool_op_base.h" 8 #include "caffe2/utils/math.h" 19 PadMode StringToPadMode(
const string&);
21 template <
typename T,
class Context>
24 USE_CONV_POOL_BASE_FUNCTIONS(Context);
27 mode_(StringToPadMode(
28 OperatorBase::GetSingleArgument<string>(
"mode",
"constant"))),
29 value_(static_cast<T>(
30 OperatorBase::GetSingleArgument<float>(
"value", 0.0))) {
32 legacy_pad_ == LegacyPadding::NOTSET,
33 "Padding layer only supports explicit pad values.");
35 dilation_h() == 1 && dilation_w() == 1,
36 "Pooling op does not support dilation right now.");
38 stride_h() == 1 && stride_w() == 1,
39 "Pooling op does not support stride right now.");
42 kernel_.assign(pads_.size() / 2, 1);
46 bool RunOnDeviceWithOrderNCHW()
override;
47 bool RunOnDeviceWithOrderNHWC()
override;
49 static std::vector<TensorShape> PadTensorInference(
50 const OperatorDef& def,
51 const vector<TensorShape>& in);
61 template <
typename T,
class Context>
64 USE_CONV_POOL_BASE_FUNCTIONS(Context);
67 mode_(StringToPadMode(
68 OperatorBase::GetSingleArgument<string>(
"mode",
"constant"))) {
70 legacy_pad_ == LegacyPadding::NOTSET,
71 "Padding layer only supports explicit pad values.");
73 dilation_h() == 1 && dilation_w() == 1,
74 "Pooling op does not support dilation right now.");
77 kernel_.assign(pads_.size() / 2, 1);
81 bool RunOnDeviceWithOrderNCHW()
override;
82 bool RunOnDeviceWithOrderNHWC()
override;
92 #endif // CAFFE2_OPERATORS_PAD_OP_H_ Workspace is a class that holds all the related objects created during runtime: (1) all blobs...
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...