2 // Copyright (c) 2017 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 ///////////////////////////////////////////////////////////////////////////////////////////////////
20 #include "program_impl.h"
21 #include "data_inst.h"
26 class constants_propagator
29 constants_propagator(program_impl::ptr program);
31 void visit_node(program_node& node);
33 std::list<std::pair<primitive_id, memory_impl::ptr>> calculate();
36 program_impl::ptr prog;
38 std::list<typed_program_node<data>*> const_inputs;
39 std::vector<primitive_id> const_outputs;
40 bool has_non_trivial_constants = false;
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);