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 ///////////////////////////////////////////////////////////////////////////////////////////////////
19 #include "../C/input_layout.h"
20 #include "primitive.hpp"
24 /// @addtogroup cpp_api C++ API
26 /// @addtogroup cpp_topology Network Topology
28 /// @addtogroup cpp_primitives Primitives
31 /// @brief Provides input layout for a data to be passed later to network.
32 /// @details This primitive allows to define the layout for input data
33 /// which will be passed to network before execution.
34 /// For example, network input images.
35 /// @note User should call network::set_input_data() for every @p input_layout primitive before network execution.
36 /// @note @p output_padding property of @p input_layout is ignored - its output layout is always equal to input layout defined during object creation.
37 /// @sa network::set_input_data(), cldnn::data
38 struct input_layout : public primitive_base<input_layout, CLDNN_PRIMITIVE_DESC(input_layout)> {
39 CLDNN_DECLARE_PRIMITIVE(input_layout)
41 /// @brief Constructs input layout primitive.
42 /// @param id This primitive id.
43 /// @param layout Defines layout for the data will be passed to network.
44 input_layout(const primitive_id& id, const layout& layout)
45 : primitive_base(id, {}, layout.data_padding), layout(layout) {}
47 /// @brief Constructs a copy from C API @CLDNN_PRIMITIVE_DESC{input_layout}
48 explicit input_layout(const dto* dto)
49 : primitive_base(dto), layout(dto->layout) {
50 output_padding = layout.data_padding;
53 /// @brief Defines layout for the data will be passed to network.
54 mutable cldnn::layout layout;
56 void change_layout(cldnn::layout new_layout) {
61 void update_dto(dto& dto) const override {