Caffe2 - C++ API
A deep learning, cross platform ML framework
lengths_reducer_ops.cc
1 
17 #include "caffe2/operators/lengths_reducer_ops.h"
18 #include "caffe2/core/context.h"
19 #include "caffe2/core/operator.h"
20 #include "caffe2/utils/math.h"
21 
22 namespace caffe2 {
23 
24 // Use _STR option because the schema is declared using _STR version too in
25 // generic fashion. Otherwise it'd break schema declaration check.
26 // TODO(dzhulgakov): remove _STR when all lengths ops are off generic version.
27 
28 REGISTER_CPU_OPERATOR_STR(
29  "SparseLengthsSum",
30  CPUSparseLengthsReductionOp<float, TensorTypes<float, float16>, 0, 0>);
31 REGISTER_CPU_OPERATOR_STR(
32  "SparseLengthsWeightedSum",
33  CPUSparseLengthsReductionOp<float, TensorTypes<float, float16>, 1, 0>);
34 REGISTER_CPU_OPERATOR_STR(
35  "SparseLengthsMean",
36  CPUSparseLengthsReductionOp<float, TensorTypes<float, float16>, 0, 1>);
37 
38 } // namespace caffe2
Copyright (c) 2016-present, Facebook, Inc.