1 #include "caffe2/queue/blobs_queue_db.h" 8 #include "caffe2/core/context.h" 9 #include "caffe2/core/logging.h" 10 #include "caffe2/core/operator.h" 11 #include "caffe2/queue/blobs_queue.h" 13 #ifdef CAFFE2_USE_MKLDNN 14 #include <caffe2/ideep/operators/operator_fallback_ideep.h> 15 #include <caffe2/ideep/utils/ideep_operator.h> 21 template <
class Context>
27 bool RunOnDevice()
override {
28 std::unique_ptr<db::DB> db = caffe2::make_unique<BlobsQueueDB>(
31 OperatorBase::Input<std::shared_ptr<BlobsQueue>>(0),
32 OperatorBase::template GetSingleArgument<int>(
"key_blob_index", -1),
33 OperatorBase::template GetSingleArgument<int>(
"value_blob_index", 0),
34 OperatorBase::template GetSingleArgument<float>(
"timeout_secs", 0.0));
35 OperatorBase::Output<db::DBReader>(0)->Open(std::move(db), 1, 0);
45 #ifdef CAFFE2_USE_MKLDNN 46 REGISTER_IDEEP_OPERATOR(
51 OPERATOR_SCHEMA(CreateBlobsQueueDB)
56 "(default: -1 (no key)) index of blob for DB key in the BlobsQueue.")
59 "(default: 0) index of blob for DB value in the BlobsQueue.")
62 "(default: 0.0 (no timeout)) Timeout in seconds for reading from the " 64 .SetDoc(
"Create a DBReader from a BlobsQueue")
65 .Input(0,
"queue",
"The shared pointer to a queue containing Blobs.")
66 .Output(0,
"reader",
"The DBReader for the given BlobsQueue");
68 SHOULD_NOT_DO_GRADIENT(CreateBlobsQueueDB);
Workspace is a class that holds all the related objects created during runtime: (1) all blobs...
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...
A templated class to allow one to wrap a CPU operator as an IDEEP operator.