1 #include "caffe2/operators/space_batch_op.h" 5 REGISTER_CPU_OPERATOR(SpaceToBatch, SpaceToBatchOp<CPUContext>);
6 OPERATOR_SCHEMA(SpaceToBatch).NumInputs(1).NumOutputs(1).SetDoc(R
"DOC( 8 SpaceToBatch for 4-D tensors of type T. 10 Zero-pads and then rearranges (permutes) blocks of spatial data into 11 batch. More specifically, this op outputs a copy of the input tensor 12 where values from the height and width dimensions are moved to the 13 batch dimension. After the zero-padding, both height and width of the 14 input must be divisible by the block size. 18 REGISTER_CPU_OPERATOR(BatchToSpace, BatchToSpaceOp<CPUContext>); 19 OPERATOR_SCHEMA(BatchToSpace).NumInputs(1).NumOutputs(1).SetDoc(R"DOC( 21 BatchToSpace for 4-D tensors of type T. 23 Rearranges (permutes) data from batch into blocks of spatial data, 24 followed by cropping. This is the reverse transformation of 25 SpaceToBatch. More specifically, this op outputs a copy of the input 26 tensor where values from the batch dimension are moved in spatial 27 blocks to the height and width dimensions, followed by cropping along 28 the height and width dimensions. 33 using GradientMakerBase::GradientMakerBase;
34 vector<OperatorDef> GetGradientDefs()
override {
36 "BatchToSpace",
"", vector<string>{GO(0)}, vector<string>{GI(0)});
41 using GradientMakerBase::GradientMakerBase;
42 vector<OperatorDef> GetGradientDefs()
override {
44 "SpaceToBatch",
"", vector<string>{GO(0)}, vector<string>{GI(0)});
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...
static vector< OperatorDef > SingleGradientDef(const Args &...args)
a helper function to allow one to create one single operator def, which is usually the case for many ...