1 #include <caffe2/ideep/ideep_utils.h> 2 #include <caffe2/queue/blobs_queue.h> 8 USE_IDEEP_DEF_ALIASES();
9 USE_IDEEP_OPERATOR_FUNCTIONS();
14 name(operator_def.output().Get(0)) {}
16 bool RunOnDevice()
override {
17 const auto capacity = GetSingleArgument(
"capacity", 1);
18 const auto numBlobs = GetSingleArgument(
"num_blobs", 1);
19 const auto enforceUniqueName =
20 GetSingleArgument(
"enforce_unique_name",
false);
21 const auto fieldNames =
22 OperatorBase::template GetRepeatedArgument<std::string>(
"field_names");
23 CAFFE_ENFORCE_EQ(this->OutputSize(), 1);
24 auto queuePtr = OperatorBase::Outputs()[0]
25 ->template GetMutable<std::shared_ptr<BlobsQueue>>();
27 CAFFE_ENFORCE(queuePtr);
28 *queuePtr = std::make_shared<BlobsQueue>(
29 ws_, name, capacity, numBlobs, enforceUniqueName, fieldNames);
35 const std::string name;
40 USE_IDEEP_DEF_ALIASES();
41 USE_IDEEP_OPERATOR_FUNCTIONS();
46 bool RunOnDevice()
override {
48 OperatorBase::Inputs()[0]->template Get<std::shared_ptr<BlobsQueue>>();
50 auto size = queue->getNumBlobs();
52 OutputSize() == size + 1,
53 "Expected " + caffe2::to_string(size + 1) +
", " +
54 " got: " + caffe2::to_string(size));
55 bool status = queue->blockingWrite(OperatorBase::Outputs());
57 auto st = OperatorBase::Output<TensorCPU>(1, CPU);
59 auto stat = st->template mutable_data<bool>();
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 ...