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/embed.h"
20 #include "primitive.hpp"
24 /// @addtogroup cpp_api C++ API
26 /// @addtogroup cpp_topology Network Topology
28 /// @addtogroup cpp_primitives Primitives
32 /// @details Performs embedding upon input.
34 /// @n input_size = { 8, 1, 1, 75 };
35 /// @n weights_size = {15, 1, 62, 1 };
36 /// @n output_size = { 8, 75, 15, 1 };
39 struct embed : public primitive_base<embed, CLDNN_PRIMITIVE_DESC(embed)>
41 CLDNN_DECLARE_PRIMITIVE(embed)
43 /// @brief Constructs embed primitive.
44 /// @param id This primitive id.
45 /// @param input Input primitive id.
46 /// @param weights Primitive id containing weights data.
47 /// @param bias Primitive id containing bias data.
49 const primitive_id& id,
50 const primitive_id& input,
51 const primitive_id& weights,
52 const primitive_id& bias
54 : primitive_base(id, { input })
59 /// @brief Constructs embed primitive.
60 /// @param id This primitive id.
61 /// @param input Input primitive id.
63 const primitive_id& id,
64 const primitive_id& input,
65 const primitive_id& weights
67 : primitive_base(id, { input })
72 /// @brief Constructs a copy from C API @CLDNN_PRIMITIVE_DESC{embed}
75 , weights(dto->weights)
80 /// @brief Primitive id containing weights data.
82 /// @brief Primitive id containing bias data.
86 std::vector<std::reference_wrapper<const primitive_id>> get_dependencies() const override
91 return{ weights, bias };
94 void update_dto(dto& dto) const override
96 dto.weights = weights.c_str();
97 dto.bias = bias.c_str();