3 #include "caffe2/utils/math.h" 7 CAFFE_KNOWN_TYPE(std::shared_ptr<BlobsQueue>);
9 REGISTER_CPU_OPERATOR(CreateBlobsQueue, CreateBlobsQueueOp<CPUContext>);
10 REGISTER_CPU_OPERATOR(EnqueueBlobs, EnqueueBlobsOp<CPUContext>);
11 REGISTER_CPU_OPERATOR(DequeueBlobs, DequeueBlobsOp<CPUContext>);
12 REGISTER_CPU_OPERATOR(CloseBlobsQueue, CloseBlobsQueueOp<CPUContext>);
14 REGISTER_CPU_OPERATOR(SafeEnqueueBlobs, SafeEnqueueBlobsOp<CPUContext>);
15 REGISTER_CPU_OPERATOR(SafeDequeueBlobs, SafeDequeueBlobsOp<CPUContext>);
16 REGISTER_CPU_OPERATOR(
17 WeightedSampleDequeueBlobs,
18 WeightedSampleDequeueBlobsOp<CPUContext>);
20 OPERATOR_SCHEMA(CreateBlobsQueue).NumInputs(0).NumOutputs(1);
21 OPERATOR_SCHEMA(EnqueueBlobs)
22 .NumInputsOutputs([](
int inputs,
int outputs) {
23 return inputs >= 2 && outputs >= 1 && inputs == outputs + 1;
25 .EnforceInplace([](
int input,
int output) {
return input == output + 1; });
26 OPERATOR_SCHEMA(DequeueBlobs)
27 .NumInputsOutputs([](
int inputs,
int outputs) {
28 return inputs == 1 && outputs >= 1;
31 Dequeue the blobs from queue. 33 .Arg("timeout_secs",
"Timeout in secs, default: no timeout")
34 .Input(0,
"queue",
"The shared pointer for the BlobsQueue")
35 .Output(0,
"blob",
"The blob to store the dequeued data");
37 OPERATOR_SCHEMA(CloseBlobsQueue).NumInputs(1).NumOutputs(0);
39 OPERATOR_SCHEMA(SafeEnqueueBlobs)
40 .NumInputsOutputs([](
int inputs,
int outputs) {
41 return inputs >= 2 && outputs >= 2 && inputs == outputs;
43 .EnforceInplace([](
int input,
int output) {
return input == output + 1; })
45 Enqueue the blobs into queue. When the queue is closed and full, the output 46 status will be set to true which can be used as exit criteria for execution 48 The 1st input is the queue and the last output is the status. The rest are 51 .Input(0, "queue",
"The shared pointer for the BlobsQueue");
53 OPERATOR_SCHEMA(SafeDequeueBlobs)
54 .NumInputsOutputs([](
int inputs,
int outputs) {
55 return inputs == 1 && outputs >= 2;
58 Dequeue the blobs from queue. When the queue is closed and empty, the output 59 status will be set to true which can be used as exit criteria for execution 61 The 1st input is the queue and the last output is the status. The rest are 66 "(default 1) If > 1, multiple records will be dequeued and tensors " 67 "for each column will be concatenated. This requires all tensors in " 68 "the records to be at least 1D, and to have the same inner dimensions.")
69 .Input(0,
"queue",
"The shared pointer for the BlobsQueue")
70 .Output(0,
"blob",
"The blob to store the dequeued data")
71 .Output(1,
"status",
"Is set to 0/1 depending on the success of dequeue");
73 OPERATOR_SCHEMA(WeightedSampleDequeueBlobs)
74 .NumInputs(1, INT_MAX)
75 .NumOutputs(2, INT_MAX)
77 Dequeue the blobs from multiple queues. When one of queues is closed and empty, 78 the output status will be set to true which can be used as exit criteria for 80 The 1st input is the queue and the last output is the status. The rest are 83 .Arg("weights",
"Weights for sampling from multiple queues")
86 "The index of the blob (among the output blob list) " 87 "that will be used to store the index of the table chosen to read the " 90 NO_GRADIENT(CreateBlobsQueue);
91 NO_GRADIENT(EnqueueBlobs);
92 NO_GRADIENT(DequeueBlobs);
93 NO_GRADIENT(CloseBlobsQueue);
95 NO_GRADIENT(SafeEnqueueBlobs);
96 NO_GRADIENT(SafeDequeueBlobs);
97 NO_GRADIENT(WeightedSampleDequeueBlobs);
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...