1 #include "caffe2/operators/mean_op.h" 5 REGISTER_CPU_OPERATOR(Mean, MeanOp<CPUContext>);
6 REGISTER_CPU_OPERATOR(MeanGradient, MeanGradientOp<CPUContext>);
11 .IdenticalTypeAndShapeOfInput(0)
12 .AllowInplace({{0, 0}})
14 Element-wise mean of each of the input tensors. The first input tensor can be 15 used in-place as the output tensor, in which case the mean will be done in 16 place and results will be accumulated in input0. All inputs and outputs must 17 have the same shape and data type. 19 .Input(0, "data_0",
"First of the input tensors. Can be inplace.")
20 .Output(0,
"mean",
"Output tensor. Same dimension as inputs.");
23 using GradientMakerBase::GradientMakerBase;
24 vector<OperatorDef> GetGradientDefs()
override {
25 auto outputs = std::vector<string>();
26 for (
int i = 0; i < def_.input_size(); i++) {
27 outputs.push_back(GI(i));
30 "MeanGradient",
"", std::vector<string>{GO(0)}, outputs);
36 OPERATOR_SCHEMA(MeanGradient)
38 .NumOutputs(1, INT_MAX)
39 .AllowInplace({{0, 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 ...