Caffe2 - C++ API
A deep learning, cross platform ML framework
rebatching_queue_ops.cc
1 #include "rebatching_queue_ops.h"
2 
3 namespace caffe2 {
4 
5 CAFFE_KNOWN_TYPE(RebatchingQueuePtr);
6 
7 namespace {
8 
9 REGISTER_CPU_OPERATOR(CreateRebatchingQueue, CreateRebatchingQueueOp);
10 REGISTER_CPU_OPERATOR(EnqueueRebatchingQueue, EnqueueRebatchingQueueOp);
11 REGISTER_CPU_OPERATOR(DequeueRebatchingQueue, DequeueRebatchingQueueOp);
12 REGISTER_CPU_OPERATOR(CloseRebatchingQueue, CloseRebatchingQueueOp);
13 
14 NO_GRADIENT(CreateRebatchingQueue);
15 NO_GRADIENT(EnqueueRebatchingQueue);
16 NO_GRADIENT(DequeueRebatchingQueue);
17 NO_GRADIENT(CloseRebatchingQueue);
18 
19 OPERATOR_SCHEMA(CreateRebatchingQueue)
20  .NumInputs(0)
21  .NumOutputs(1)
22  .SetDoc(R"DOC(
23 Creates the Queue.
24 )DOC")
25  .Output(0, "queue", "object representing the queue")
26  .Arg("num_blobs", "Number of input tensors the queue will support")
27  .Arg(
28  "capacity",
29  "Maximal number of elements the queue can hold at any given point");
30 
31 OPERATOR_SCHEMA(CloseRebatchingQueue)
32  .NumInputs(1)
33  .NumOutputs(0)
34  .SetDoc(R"DOC(
35 Closes the Queue.
36 )DOC")
37  .Input(0, "queue", "object representing the queue");
38 
39 OPERATOR_SCHEMA(EnqueueRebatchingQueue)
40  .NumInputs(2, INT_MAX)
41  .NumOutputs(0)
42  .SetDoc(R"DOC(
43 Enqueues Tensors into the queue.
44 Number of input tensors should be equal to the number of components passed
45 during creation of the queue.
46 If the Queue is closed this operation will fail.
47 If enqueue_batch argument is set. We will split the input tensors by the
48 first dimension to produce single queue elements.
49 )DOC")
50  .Input(0, "queue", "object representing the queue")
51  .Input(1, "tensor", "First tensor to enque. ")
52  .Arg(
53  "enqueue_batch",
54  "Are we enqueuing a batch or just a single element. \
55  By default we enqueue single element.");
56 
57 OPERATOR_SCHEMA(DequeueRebatchingQueue)
58  .NumInputs(1)
59  .NumOutputs(1, INT_MAX)
60  .SetDoc(R"DOC(
61 Dequeue Tensors from the Queue.
62 If the Queue is closed this might return less elements than asked.
63 If num_elements > 1 the returned elements will be concatenated into one
64 tensor per component.
65 )DOC")
66  .Input(0, "rebatching_queue", "object representing the queue")
67  .Input(1, "tensor", "First tensor to enqueue")
68  .Arg(
69  "num_elements",
70  "Number of elements to dequeue. By default we dequeue one element.");
71 }
72 }
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...
Definition: blob.h:13