1 // Copyright (C) 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 SplitConstInfer : public ConstInferImpl {
24 explicit SplitConstInfer(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 {
32 layer.params = params;
34 _validator->parseParams(&layer);
36 auto inBlob = *inData.begin();
37 SizeVector inShape = inBlob->getTensorDesc().getDims();
38 const auto* inBuffer = inBlob->cbuffer().as<float*>();
41 for (int i = 0; i < layer._axis; i++)
42 outerSize *= inShape[i];
44 for (size_t osIdx = 0; osIdx < outerSize; osIdx++) {
45 for (auto& outBlob : outData) {
46 auto* outBuffer = outBlob->buffer().as<float*>();
47 size_t innerSize = outBlob->size() / outerSize;
49 for (size_t j = 0; j < innerSize; j++, inBuffer++) {
50 outBuffer[osIdx * innerSize + j] = *inBuffer;
57 } // namespace ShapeInfer
58 } // namespace InferenceEngine