Publishing 2019 R1 content
[platform/upstream/dldt.git] / inference-engine / thirdparty / clDNN / src / include / index_select_inst.h
1 /*
2 // Copyright (c) 2018 Intel Corporation
3 //
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
7 //
8 //      http://www.apache.org/licenses/LICENSE-2.0
9 //
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.
15 */
16
17 ///////////////////////////////////////////////////////////////////////////////////////////////////
18 #pragma once
19 #include "api/CPP/index_select.hpp"
20 #include "primitive_inst.h"
21
22 #include <memory>
23
24 namespace cldnn
25 {
26
27         template <>
28         struct typed_program_node<index_select> : public typed_program_node_base<index_select>
29         {
30                 using parent = typed_program_node_base<index_select>;
31
32         public:
33                 typed_program_node(std::shared_ptr<primitive> prim, program_impl& prog)
34                         : parent(prim, prog)
35                 {
36                 }
37                 program_node& input() const { return get_dependency(0); }
38         program_node& indices() const { return get_dependency(1); }
39         bool get_reverse() const { return get_primitive()->reverse; }
40         std::vector<index_select_axis_name> get_axes() const { return get_primitive()->axis; }
41         };
42
43         using index_select_node = typed_program_node<index_select>;
44
45         template <>
46         class typed_primitive_inst<index_select> : public typed_primitive_inst_base<index_select>
47         {
48                 using parent = typed_primitive_inst_base<index_select>;
49
50         public:
51                 static layout calc_output_layout(index_select_node const& node);
52                 static std::string to_string(index_select_node const& node);
53                 typed_primitive_inst(network_impl& network, index_select_node const& node);
54
55         memory_impl& input() const { return dep_memory(0); }
56         memory_impl& indices() const { return dep_memory(1); }
57         bool get_reverse() const { return node.get_reverse(); }
58         std::vector<index_select_axis_name> get_axes() const { return node.get_axes(); }
59         };
60
61         using index_select_inst = typed_primitive_inst<index_select>;
62
63 }