Publishing R3
[platform/upstream/dldt.git] / inference-engine / thirdparty / clDNN / kernel_selector / core / actual_kernels / lookup_table / lookup_table_kernel_base.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 #pragma once
18
19 #include "common_kernel_base.h"
20 #include "kernel_selector_params.h"
21
22 namespace kernel_selector
23 {
24     ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
25     // lookup_table_params
26     ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
27     struct lookup_table_params : public base_params
28     {
29         lookup_table_params() : base_params(KernelType::LOOKUP_TABLE) {}
30
31         LookUpTableAxis lookUpTableAxis = LookUpTableAxis::XYF;
32         uint32_t                numberOfValues;
33         DataTensor      inputIndices;
34
35         virtual ParamsKey GetParamsKey() const
36         {
37             ParamsKey k = base_params::GetParamsKey();
38             k.EnableLookUpTableAxis(lookUpTableAxis);
39             k.EnableLookUpTableIndicesFormat(inputIndices.GetDType());
40             return k;
41         }
42     };
43
44     ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
45     // lookup_table_optional_params
46     ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
47     struct lookup_table_optional_params : optional_params
48     {
49         lookup_table_optional_params() : optional_params(KernelType::LOOKUP_TABLE) {}
50     };
51
52     ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
53     // lookup_table_params
54     ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
55     class LookUpTableKernelBase : public common_kernel_base
56     {
57     public:
58         using common_kernel_base::common_kernel_base;
59         virtual ~LookUpTableKernelBase() {}
60
61         struct DispatchData : public CommonDispatchData
62         {
63         };
64
65     protected:
66         virtual bool Validate(const Params&, const optional_params&) const override;
67         virtual JitConstants GetJitConstants(const lookup_table_params& params) const;
68         virtual DispatchData SetDefault(const lookup_table_params& params) const;
69         KernelsData GetCommonKernelsData(const Params& params, const optional_params&, float estimatedTime) const;
70     };
71 }