a220b2229218864fa4eca998d72b1201c0f55253
[platform/upstream/dldt.git] / inference-engine / src / inference_engine / shape_infer / built-in / ie_psroi_pooling_shape_infer.hpp
1 // Copyright (C) 2018 Intel Corporation
2 //
3 // SPDX-License-Identifier: Apache-2.0
4 //
5
6 #pragma once
7
8 #include <description_buffer.hpp>
9 #include "ie_built_in_impl.hpp"
10 #include <ie_layers.h>
11 #include <map>
12 #include <memory>
13 #include <string>
14 #include <vector>
15
16 namespace InferenceEngine {
17 namespace ShapeInfer {
18
19 /**
20  *@brief Implementation of Shape inference for PSRoiPooling layer
21  */
22 class PSRoiPoolingShapeProp : public BuiltInShapeInferImpl {
23 public:
24     explicit PSRoiPoolingShapeProp(const std::string& type) : BuiltInShapeInferImpl(type) {}
25
26     void inferShapesImpl(const std::vector<SizeVector>& inShapes,
27                          const std::map<std::string, std::string>& params,
28                          const std::map<std::string, Blob::Ptr>& blobs,
29                          std::vector<SizeVector>& outShapes) override {
30         LayerParams lp{};
31         CNNLayer cnnLayer(lp);
32         cnnLayer.params = params;
33         cnnLayer.type = _type;
34         validate(&cnnLayer, inShapes, params, blobs);
35         size_t output_dim = static_cast<size_t>(cnnLayer.GetParamAsInt("output_dim"));
36         size_t group_size = static_cast<size_t>(cnnLayer.GetParamAsInt("group_size"));
37         outShapes.push_back({inShapes[1][0], output_dim, group_size, group_size});
38     }
39 };
40
41 }  // namespace ShapeInfer
42 }  // namespace InferenceEngine