1 #include "caffe2/operators/lengths_reducer_ops.h" 2 #include "caffe2/core/context.h" 3 #include "caffe2/core/operator.h" 4 #include "caffe2/utils/math.h" 12 REGISTER_CPU_OPERATOR_STR(
14 CPUSparseLengthsReductionOp<
float, TensorTypes<float, float16>, 0, 0>);
15 REGISTER_CPU_OPERATOR_STR(
16 "SparseLengthsWeightedSum",
17 CPUSparseLengthsReductionOp<
float, TensorTypes<float, float16>, 1, 0>);
18 REGISTER_CPU_OPERATOR_STR(
20 CPUSparseLengthsReductionOp<
float, TensorTypes<float, float16>, 0, 1>);
22 OPERATOR_SCHEMA(SparseLengthsPositionalWeightedSum)
26 Variation of SparseLengthsWeightedSum operator, where, for each row, 27 weights are accessed by indices [0..L-1], where L is the length of given row. 28 This is basically a fused operator of LengthsRangeFill + Gather + 34 "uint8 tensor obtained with " 35 "operator FloatToRowwiseQuantized8Bits")
39 "Scalar multipliers for the input slices. Must " 40 "be a vector with the length matching the length of DATA")
44 "Integer vector containing indices of the first " 45 "dimension of DATA for the slices that are being aggregated")
49 "Vector with the same sum of elements as the first dimension of DATA")
50 .Output(0,
"output",
"output");
52 REGISTER_CPU_OPERATOR_STR(
53 "SparseLengthsPositionalWeightedSum",
54 CPUSparseLengthsReductionOp<
float, TensorTypes<float, float16>, 1, 0, 1>);
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...