2 // Copyright (c) 2016 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 ///////////////////////////////////////////////////////////////////////////////////////////////////
18 #include "input_layout_inst.h"
19 #include "primitive_type_base.h"
20 #include "memory_impl.h"
21 #include "error_handler.h"
22 #include "json_object.h"
26 primitive_type_id input_layout_type_id()
28 static primitive_type_base<input_layout> instance;
32 input_layout_node::typed_program_node(const std::shared_ptr<input_layout> dprim, program_impl& prog)
35 can_share_buffer(false);
38 input_layout_inst::typed_primitive_inst(network_impl& network, input_layout_node const& node)
39 : parent(network, node)
41 _has_valid_input = false; //by default input for 'input_layout' is invalid as long as user doesn't call set_data
44 void input_layout_inst::set_data(memory_impl& mem)
47 CLDNN_ERROR_LAYOUT_MISMATCH("input layout", "memory layout", mem.get_layout(), "output memory layout", node.get_output_layout(), "");
49 if (mem.is_allocated_by(get_network().get_engine()))
55 mem_lock<char> src(&mem);
56 mem_lock<char> dst(_output);
57 std::copy(src.begin(), src.end(), dst.begin());
60 _has_valid_input = true;
61 _output_changed = true;
64 std::string input_layout_inst::to_string(input_layout_node const& node)
66 auto node_info = node.desc_to_json();
68 std::stringstream primitive_description;
70 node_info->dump(primitive_description);
72 return primitive_description.str();