2 // Copyright (c) 2018 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/lookup_table.h"
20 #include "primitive.hpp"
24 /// @addtogroup cpp_api C++ API
26 /// @addtogroup cpp_topology Network Topology
28 /// @addtogroup cpp_primitives Primitives
31 /// @brief Returns values from data on which given indices are pointing at.
32 struct lookup_table : public primitive_base<lookup_table, CLDNN_PRIMITIVE_DESC(lookup_table)>
34 CLDNN_DECLARE_PRIMITIVE(lookup_table)
36 /// @brief Enum type to specify axis to maximize/minimize along.
46 /// @brief Constructs lookup_table primitive.
47 /// @param id This primitive id.
48 /// @param input_data Input data primitive id.
49 /// @param input_indices Input indices primitive id.
50 /// @param axis Axis to return values from.
52 const primitive_id& id,
53 const primitive_id& input_data,
54 const primitive_id& input_indices,
55 axis_name axis = axis_name::xyf,
56 const padding& output_padding = padding()
58 :primitive_base(id, { input_data, input_indices }, output_padding)
60 , with_axis(axis == axis_name::xyf ? false : true)
63 /// @brief Constructs a copy from C API @CLDNN_PRIMITIVE_DESC{lookup_table}
64 lookup_table(const dto* dto)
66 , axis(static_cast<axis_name>(dto->axis))
67 , with_axis(dto->with_axis != 0)
70 /// @brief Axis to return values from. If not set, returns data which index is pointing at in the flattened x, y, f dimensions for each batch.
72 /// @brief Indicates that the primitive has user defined axis to return values from.
77 void update_dto(dto& dto) const override
79 dto.with_axis = with_axis;
80 dto.axis = static_cast<cldnn_lookup_table_axis>(axis);