1 // Copyright (C) 2019 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
7 #include "ie_built_in_impl.hpp"
13 namespace InferenceEngine {
14 namespace ShapeInfer {
17 *@brief Implementation of Shape inference for Fill layer
19 class FillShapeProp : public BuiltInShapeInferImpl {
21 explicit FillShapeProp(const std::string& type) : BuiltInShapeInferImpl(type) {}
23 void inferShapesImpl(const std::vector<Blob::CPtr>& inBlobs,
24 const std::map<std::string, std::string>& params,
25 const std::map<std::string, Blob::Ptr>& blobs,
26 std::vector<SizeVector>& outShapes) override {
28 FillLayer fillLayer(lp);
29 fillLayer.params = params;
30 fillLayer.type = _type;
31 validate(&fillLayer, inBlobs, params, blobs);
33 auto dimsBlob = *inBlobs.begin();
35 SizeVector dims = dimsBlob->getTensorDesc().getDims();
36 auto* buffer = dimsBlob->cbuffer().as<int32_t*>();
37 if (!buffer || dimsBlob->getTensorDesc().getPrecision() != Precision::I32)
38 THROW_IE_EXCEPTION << " Fill dimensions vector should be I32!";
40 for (int i = 0; i < dimsBlob->size(); i++) {
41 shape.push_back(buffer[i]);
47 } // namespace ShapeInfer
48 } // namespace InferenceEngine