1 // Copyright (C) 2018 Intel Corporation
3 // SPDX-License-Identifier: Apache-2.0
8 #include <description_buffer.hpp>
9 #include <ie_layer_validators.hpp>
10 #include "impl_register.hpp"
11 #include <ie_layers.h>
17 namespace InferenceEngine {
18 namespace ShapeInfer {
21 *@brief Implementation of Shape inference for ReorgYolo layer
23 class ReorgYoloShapeProp : public BuiltInShapeInferImpl {
25 explicit ReorgYoloShapeProp(const std::string& type) : BuiltInShapeInferImpl(type) {}
27 void inferShapesImpl(const std::vector<SizeVector>& inShapes,
28 const std::map<std::string, std::string>& params,
29 const std::map<std::string, Blob::Ptr>& blobs,
30 std::vector<SizeVector>& outShapes) override {
32 CNNLayer cnnLayer(lp);
33 cnnLayer.params = params;
34 cnnLayer.type = _type;
35 validate(&cnnLayer, inShapes, params, blobs);
36 size_t stride = static_cast<size_t>(cnnLayer.GetParamAsInt("stride"));
38 for (size_t i = 0; i < inShapes[0].size(); i++) {
39 outShape.push_back(inShapes[0][i]);
41 outShape[outShape.size() - 1] *= stride * stride;
43 outShape[outShape.size() - 1] /= stride;
46 outShapes.push_back(outShape);
50 } // namespace ShapeInfer
51 } // namespace InferenceEngine