1 // Copyright (c) 2018 Intel Corporation
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 ///////////////////////////////////////////////////////////////////////////////////////////////////
16 #include "pyramid_roi_align_inst.h"
17 #include "primitive_type_base.h"
18 #include "error_handler.h"
19 #include "json_object.h"
22 primitive_type_id pyramid_roi_align_type_id()
24 static primitive_type_base<pyramid_roi_align> instance;
28 layout pyramid_roi_align_inst::calc_output_layout(pyramidROIAlign_node const &node)
30 assert((bool)node.get_primitive()->output_data_type == false
31 && "Output data type forcing is not supported for "
32 "pyramidROIAlign_node!");
34 auto desc = node.get_primitive();
36 auto boxes_layout = node.boxes().get_output_layout();
37 auto P2_layout = node.P2().get_output_layout();
38 auto pool_size_layout = node.pool_size().get_output_layout();
40 int32_t output_b = boxes_layout.size.spatial[1];
41 int32_t output_f = P2_layout.size.feature[0];
43 int32_t output_x = pool_size_layout.size.spatial[0];
44 int32_t output_y = pool_size_layout.size.spatial[1];
46 return layout{ P2_layout.data_type, P2_layout.format, { output_b, output_f, output_x, output_y } };
49 std::string pyramid_roi_align_inst::to_string(pyramidROIAlign_node const& node)
51 auto desc = node.get_primitive();
52 auto node_info = node.desc_to_json();
53 std::stringstream primitive_description;
54 json_composite pyramid_roi_align_info;
55 node_info->add("pyramid_roi_align_info", pyramid_roi_align_info);
56 node_info->dump(primitive_description);
57 return primitive_description.str();
60 pyramid_roi_align_inst::typed_primitive_inst(network_impl& network, pyramidROIAlign_node const& node)
61 : parent(network, node)