Unverified Commit b2e7114d authored by Ilya Churaev's avatar Ilya Churaev Committed by GitHub

Fixed memory blob (#4338)

* Fixed memory blob

* Fixed code style
Co-authored-by: 's avatarSang Ik Lee <sang.ik.lee@intel.com>
parent 1f69da4e
......@@ -35,9 +35,9 @@ Blob::Ptr fill_blob(SizeVector shape, std::vector<float> data)
case 5: layout = Layout::NCDHW; break;
default: THROW_IE_EXCEPTION << "Can't convert dims " << shape.size() << " to Layout!";
}
Blob::Ptr blob(new TBlob<float>({Precision::FP32, shape, layout}));
MemoryBlob::Ptr blob(new TBlob<float>({Precision::FP32, shape, layout}));
blob->allocate();
float* blob_ptr = (float*)(void*)blob->buffer();
float* blob_ptr = blob->rwmap().as<float*>();
for (int i = 0; i < data.size(); i++)
{
blob_ptr[i] = data[i];
......
......@@ -144,7 +144,15 @@ namespace ngraph
inferRequest.Infer();
InferenceEngine::Blob::Ptr output = inferRequest.GetBlob(output_name);
float* output_ptr = output->buffer().as<float*>();
InferenceEngine::MemoryBlob::Ptr moutput =
InferenceEngine::as<InferenceEngine::MemoryBlob>(output);
if (!moutput)
{
THROW_IE_EXCEPTION << "Cannot get output MemoryBlob in call_with_validate()";
}
auto lm = moutput->rmap();
float* output_ptr = lm.as<float*>();
// TODO: how to get size without explicit calculation?
size_t size = 1;
for (const auto& dim : output->getTensorDesc().getDims())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment