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 SpaceToDepth layer
19 class SpaceToDepthShapeProp : public BuiltInShapeInferImpl {
21 explicit SpaceToDepthShapeProp(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 SpaceToDepthLayer spaceToDepthLayer(lp);
29 spaceToDepthLayer.params = params;
30 spaceToDepthLayer.type = _type;
31 validate(&spaceToDepthLayer, inBlobs, params, blobs);
33 unsigned int block_size = spaceToDepthLayer.block_size;
34 outShapes = {inShapes[0]};
36 outShapes[0][outShapes[0].size() - 1] = inShapes[0][inShapes[0].size() - 1] / block_size;
37 outShapes[0][outShapes[0].size() - 2] = inShapes[0][inShapes[0].size() - 2] / block_size;
38 outShapes[0][outShapes[0].size() - 3] = inShapes[0][inShapes[0].size() - 3] * block_size * block_size;
42 } // namespace ShapeInfer
43 } // namespace InferenceEngine