Publishing 2019 R1 content
[platform/upstream/dldt.git] / inference-engine / src / inference_engine / shape_infer / const_infer / ie_const_infer_impl.cpp
1 // Copyright (C) 2019 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
3 //
4
5 #include <map>
6 #include <vector>
7 #include <string>
8 #include "ie_const_infer_impl.hpp"
9
10 using namespace InferenceEngine;
11 using namespace ShapeInfer;
12
13 void ConstInferImpl::infer(const std::vector<Blob::CPtr>& inData,
14                            const std::map<std::string, std::string>& params,
15                            const std::map<std::string, Blob::Ptr>& blobs,
16                            std::vector<Blob::Ptr>& outData) {
17     std::string errorPrefix = "Ref infer error for Layer with `" + _type + "` type: ";
18     if (outData.empty()) THROW_IE_EXCEPTION << errorPrefix + "output data is empty";
19     for (auto const& data : outData) {
20         if (data->buffer() == nullptr) THROW_IE_EXCEPTION << errorPrefix + "output data is not allocated";
21     }
22     // TODO: check for direct (NCHW, NCH, NC) and FP32
23     inferImpl(inData, params, blobs, outData);
24 }
25