1 #include "caffe2/operators/loss_op.h" 5 REGISTER_CPU_OPERATOR(AveragedLoss, AveragedLoss<float, CPUContext>);
6 REGISTER_CPU_OPERATOR(AveragedLossGradient,
7 AveragedLossGradient<float, CPUContext>);
9 OPERATOR_SCHEMA(AveragedLoss)
12 .ScalarType(TensorProto::FLOAT)
14 AveragedLoss takes in a 1-D tensor as input and returns a single output float 15 value which represents the average of input data (average of the losses). 17 .Input(0, "input",
"The input data as Tensor")
18 .Output(0,
"output",
"The output tensor of size 1 containing the averaged " 21 OPERATOR_SCHEMA(AveragedLossGradient).NumInputs(2).NumOutputs(1);
24 using GradientMakerBase::GradientMakerBase;
25 vector<OperatorDef> GetGradientDefs()
override {
27 "AveragedLossGradient",
"",
28 vector<string>{I(0), GO(0)},
29 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 ...