1 // Copyright (C) 2018-2019 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
12 #include <ie_layers.h>
13 #include <ie_memcpy.h>
14 #include "ie_const_infer_impl.hpp"
16 namespace InferenceEngine {
17 namespace ShapeInfer {
20 *@brief Implementation of Const inference for Tile layer
22 class ConcatConstInfer : public ConstInferImpl {
24 explicit ConcatConstInfer(const std::string& type) : ConstInferImpl(type) {}
26 void inferImpl(const std::vector<Blob::CPtr>& inData,
27 const std::map<std::string, std::string>& params,
28 const std::map<std::string, Blob::Ptr>& blobs,
29 std::vector<Blob::Ptr>& outData) override {
31 ConcatLayer layer(lp);
32 layer.params = params;
34 _validator->parseParams(&layer);
36 auto outBlob = *outData.begin();
37 SizeVector outShape = outBlob->getTensorDesc().getDims();
38 auto* outBuffer = outBlob->buffer().as<float*>();
41 for (int i = 0; i < layer._axis; i++)
42 outerSize *= outShape[i];
45 for (size_t osIdx = 0; osIdx < outerSize; osIdx++) {
46 for (auto& inBlob : inData) {
47 const auto* inBuffer = inBlob->cbuffer().as<float*>();
48 size_t innerSize = inBlob->size() / outerSize;
50 for (size_t j = 0; j < innerSize; j++, outIdx++) {
51 outBuffer[outIdx] = inBuffer[osIdx * innerSize + j];
58 } // namespace ShapeInfer
59 } // namespace InferenceEngine