1 #include "caffe2/operators/prepend_dim_op.h" 5 REGISTER_CPU_OPERATOR(PrependDim, PrependDimOp<CPUContext>);
6 REGISTER_CPU_OPERATOR(MergeDim, MergeDimOp<CPUContext>);
8 OPERATOR_SCHEMA(PrependDim)
11 .AllowInplace({{0, 0}})
13 Reshape the tensor by prepending a dimension of fixed size and dividing the 14 size of the next dimension by that amount. 16 .Arg("dim_size",
"Size of the dimension to prepend.")
17 .Input(0,
"data",
"An input tensor.")
18 .Output(0,
"reshaped",
"Reshaped tensor.");
20 OPERATOR_SCHEMA(MergeDim)
23 .AllowInplace({{0, 0}})
25 Merge first two dimensions in a single dimension with size dim(0) * dim(1). 27 .Input(0, "data",
"An input tensor.")
28 .Output(0,
"reshaped",
"Reshaped tensor.")
29 .InheritOnnxSchema(
"Reshape");
32 using GradientMakerBase::GradientMakerBase;
33 vector<OperatorDef> GetGradientDefs()
override {
35 "MergeDim",
"", vector<string>{GO(0)}, vector<string>{GI(0)});
39 bool CopyArguments()
const override {
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 ...