2 // Copyright (c) 2019 Intel Corporation
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
17 ///////////////////////////////////////////////////////////////////////////////////////////////////
19 #include "pass_manager.h"
20 #include "prior_box_inst.h"
21 #include "program_node.h"
22 #include "program_impl.h"
24 using namespace cldnn;
26 void calculate_prior_boxes::run(program_impl& p)
28 auto itr = p.get_processing_order().begin();
29 while (itr != p.get_processing_order().end())
31 auto& node = (*itr++);
32 if (!node->is_type<prior_box>())
35 auto& pb_node = node->as<prior_box>();
37 pb_node.calc_result();
38 p.remove_connection(pb_node.input(), pb_node);
40 auto& result = pb_node.get_result_buffer();
41 result.add_ref(); // need to inc ref count since we will be assigning this memory as cldnn_memory in next line that is not ref_count_obj
42 auto cpp_mem = details::memory_c_to_cpp_converter::convert(api_cast(&result));
44 auto& data_node = p.get_or_create(std::make_shared<data>("_cldnn_tmp_" + pb_node.id() + "_result", cpp_mem));
45 p.replace(pb_node, data_node);