Caffe2 - C++ API
A deep learning, cross platform ML framework
dense_vector_to_id_list_op.cc
1 #include "caffe2/operators/dense_vector_to_id_list_op.h"
2 
3 namespace caffe2 {
4 namespace {
5 REGISTER_CPU_OPERATOR(DenseVectorToIdList, DenseVectorToIdListOp<CPUContext>);
6 
7 OPERATOR_SCHEMA(DenseVectorToIdList)
8  .NumInputs(1)
9  .NumOutputs(2)
10  .SetDoc(R"DOC(
11 DenseVectorToIdList: Convert a blob with dense feature into a ID_LIST.
12 
13 An ID_LIST is a list of IDs (may be ints, often longs) that represents a single
14 feature. As described in https://caffe2.ai/docs/sparse-operations.html, a batch
15 of ID_LIST examples is represented as a pair of lengths and values where the
16 `lengths` (int32) segment the `values` or ids (int32/int64) into examples.
17 
18 Input is a single blob where the first dimension is the batch size and the
19 second dimension is the length of dense vectors. This operator produces a
20 ID_LIST where out_values are the indices of non-zero entries
21 and out_lengths are the number of non-zeros entries in each row.
22 
23 )DOC")
24  .Input(0, "values", "A data blob of dense vectors")
25  .Output(0, "out_lengths", "Lengths of the sparse feature")
26  .Output(1, "out_values", "Values of the sparse feature");
27 NO_GRADIENT(DenseVectorToIdList);
28 } // namespace
29 } // namespace caffe2
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...
Definition: blob.h:13