Add a section of how to link IE with CMake project (#99)
[platform/upstream/dldt.git] / inference-engine / thirdparty / clDNN / src / include / constants_propagator.h
1 /*
2 // Copyright (c) 2017 Intel Corporation
3 //
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
7 //
8 //      http://www.apache.org/licenses/LICENSE-2.0
9 //
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.
15 */
16
17 ///////////////////////////////////////////////////////////////////////////////////////////////////
18 #pragma once
19
20 #include "program_impl.h"
21 #include "data_inst.h"
22
23 namespace cldnn
24 {
25
26 class constants_propagator
27 {
28 public:
29     constants_propagator(program_impl::ptr program);
30
31     void visit_node(program_node& node);
32
33     std::list<std::pair<primitive_id, memory_impl::ptr>> calculate();
34
35 private:
36     program_impl::ptr prog;
37     topology_impl tpl;
38     std::list<typed_program_node<data>*> const_inputs;
39     std::vector<primitive_id> const_outputs;
40     bool has_non_trivial_constants = false;
41
42     void handle_constant(program_node& node);
43     void add_constant(program_node& node);
44     void add_deps_to_tpl(const std::vector<program_node*>& node);
45     bool is_already_in_tpl(const primitive_id& id);
46 };
47
48 }