1 // Copyright (C) 2019 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
12 #include <ie_layers.h>
14 namespace InferenceEngine {
15 namespace ShapeInfer {
18 *@brief Implementation of Const inference for TBD layer
20 class ShapeConstInfer : public ConstInferImpl {
22 explicit ShapeConstInfer(const std::string& type) : ConstInferImpl(type) {}
24 void inferImpl(const std::vector<Blob::CPtr>& inData,
25 const std::map<std::string, std::string>& params,
26 const std::map<std::string, Blob::Ptr>& blobs,
27 std::vector<Blob::Ptr>& outData) override {
28 SizeVector inShape = (*inData.begin())->getTensorDesc().getDims();
29 auto outBlob = *outData.begin();
30 if (inShape.size() != outBlob->size()) THROW_IE_EXCEPTION << "Number of shapes don't match size of output";
31 auto* outBuffer = outBlob->buffer().as<float*>();
32 for (int i = 0; i < outBlob->size(); i++) {
33 outBuffer[i] = inShape[i];
38 } // namespace ShapeInfer
39 } // namespace InferenceEngine