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 "../C/gather.h"
20 #include "primitive.hpp"
24 /// @addtogroup cpp_api C++ API
26 /// @addtogroup cpp_topology Network Topology
28 /// @addtogroup cpp_primitives Primitives
33 struct gather : public primitive_base<gather, CLDNN_PRIMITIVE_DESC(gather)>
35 CLDNN_DECLARE_PRIMITIVE(gather)
39 along_b = cldnn_gather_along_b,
40 along_f = cldnn_gather_along_f,
41 along_x = cldnn_gather_along_x,
42 along_y = cldnn_gather_along_y
45 /// @brief Constructs gather primitive.
46 /// @param id This primitive id.
47 /// @param dict Input dictionary primitive id.
48 /// @param idx Input indexes primitive id.
49 /// @param axis Gathering axis.
50 /// @param output_shape Output shape.
52 const primitive_id& id,
53 const primitive_id& dict,
54 const primitive_id& idx,
55 const gather_axis axis,
56 const tensor& output_shape,
57 const padding& output_padding = padding()
59 : primitive_base(id, {dict, idx}, output_padding)
61 , output_shape(output_shape)
65 /// @brief Constructs a copy from C API @CLDNN_PRIMITIVE_DESC{gather}
66 gather(const dto* dto)
68 , axis(static_cast<gather_axis >(dto->axis))
69 , output_shape(dto->output_shape)
73 /// @brief Gathering axis
75 /// @brief Gathering input shape
79 void update_dto(dto& dto) const override
81 dto.axis = static_cast<cldnn_gather_axis>(axis);
82 dto.output_shape = output_shape;