Caffe2 - C++ API
A deep learning, cross platform ML framework
tensor_protos_db_input.cc
1 
17 #include "caffe2/operators/tensor_protos_db_input.h"
18 
19 namespace caffe2 {
20 REGISTER_CPU_OPERATOR(TensorProtosDBInput, TensorProtosDBInput<CPUContext>);
21 
22 OPERATOR_SCHEMA(TensorProtosDBInput)
23  .NumInputs(1)
24  .NumOutputs(1, INT_MAX)
25  .SetDoc(R"DOC(
26 TensorProtosDBInput is a simple input operator that basically reads things
27 from a db where each key-value pair stores an index as key, and a TensorProtos
28 object as value. These TensorProtos objects should have the same size, and they
29 will be grouped into batches of the given size. The DB Reader is provided as
30 input to the operator and it returns as many output tensors as the size of the
31 TensorProtos object. Each output will simply be a tensor containing a batch of
32 data with size specified by the 'batch_size' argument containing data from the
33 corresponding index in the TensorProtos objects in the DB.
34 )DOC")
35  .Arg("batch_size", "(int, default 0) the number of samples in a batch. The "
36  "default value of 0 means that the operator will attempt to insert the "
37  "entire data in a single output blob.")
38  .Input(0, "data", "A pre-initialized DB reader. Typically, this is obtained "
39  "by calling CreateDB operator with a db_name and a db_type. The "
40  "resulting output blob is a DB Reader tensor")
41  .Output(0, "output", "The output tensor in which the batches of data are "
42  "returned. The number of output tensors is equal to the size of "
43  "(number of TensorProto's in) the TensorProtos objects stored in the "
44  "DB as values. Each output tensor will be of size specified by the "
45  "'batch_size' argument of the operator");
46 
47 NO_GRADIENT(TensorProtosDBInput);
48 } // namespace caffe2
Copyright (c) 2016-present, Facebook, Inc.