1 #include "caffe2/operators/utility_ops.h" 6 OpSchema::Cost CostInferenceForSum(
7 const OperatorDef& def,
8 const vector<TensorShape>& in) {
9 struct OpSchema::Cost cost = PointwiseCostInference<1>(def, in);
10 cost.flops *= (in.size() - 1);
11 cost.params_bytes = 0;
16 REGISTER_CPU_OPERATOR(Sum, SumOp<CPUContext>);
19 .NumInputs(1, INT_MAX)
21 .AllowInplace({{0, 0}})
22 .CostInferenceFunction(CostInferenceForSum)
23 .InputsCanCrossDevices()
24 .IdenticalTypeAndShapeOfInput(0)
26 Element-wise sum of each of the input tensors. The first input tensor can be 27 used in-place as the output tensor, in which case the sum will be done in 28 place and results will be accumulated in input0. All inputs and outputs must 29 have the same shape and data type. 31 .Input(0, "data_0",
"First of the input tensors. Can be inplace.")
32 .Output(0,
"sum",
"Output tensor. Same dimension as inputs.")
33 .InheritOnnxSchema(
"Sum");
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...