Caffe2 - C++ API
A deep learning, cross platform ML framework
merge_id_lists_op.cc
1 #include "caffe2/operators/merge_id_lists_op.h"
2 
3 namespace caffe2 {
4 namespace {
5 REGISTER_CPU_OPERATOR(MergeIdLists, MergeIdListsOp<CPUContext>);
6 
7 OPERATOR_SCHEMA(MergeIdLists)
8  .NumInputs([](int n) { return (n > 0 && n % 2 == 0); })
9  .NumOutputs(2)
10  .SetDoc(R"DOC(
11 MergeIdLists: Merge multiple ID_LISTs into a single 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 Given multiple inputs of the form lengths_0, values_0, lengths_1, values_1, ...
19 which correspond to lengths and values of ID_LISTs of different features, this
20 operator produces a merged ID_LIST that combines the ID_LIST features. The
21 final merged output is described by a lengths and values vector.
22 
23 WARNING: The merge makes no guarantee about the relative order of ID_LISTs
24 within a batch. This can be an issue if ID_LIST are order sensitive.
25 )DOC")
26  .Input(0, "lengths_0", "Lengths of the ID_LISTs batch for first feature")
27  .Input(1, "values_0", "Values of the ID_LISTs batch for first feature")
28  .Output(0, "merged_lengths", "Lengths of the merged ID_LISTs batch")
29  .Output(1, "merged_values", "Values of the merged ID_LISTs batch");
30 NO_GRADIENT(MergeIdLists);
31 }
32 }
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...
Definition: blob.h:13