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.
19 #include "common_kernel_base.h"
20 #include "kernel_selector_params.h"
22 namespace kernel_selector {
23 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
24 // lookup_table_params
25 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
26 struct lookup_table_params : public base_params {
27 lookup_table_params() : base_params(KernelType::LOOKUP_TABLE) {}
29 LookUpTableAxis lookUpTableAxis = LookUpTableAxis::XYF;
30 uint32_t numberOfValues;
31 DataTensor inputIndices;
33 virtual ParamsKey GetParamsKey() const {
34 ParamsKey k = base_params::GetParamsKey();
35 k.EnableLookUpTableAxis(lookUpTableAxis);
36 k.EnableLookUpTableIndicesFormat(inputIndices.GetDType());
41 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
42 // lookup_table_optional_params
43 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
44 struct lookup_table_optional_params : optional_params {
45 lookup_table_optional_params() : optional_params(KernelType::LOOKUP_TABLE) {}
48 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
49 // lookup_table_params
50 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
51 class LookUpTableKernelBase : public common_kernel_base {
53 using common_kernel_base::common_kernel_base;
54 virtual ~LookUpTableKernelBase() {}
56 struct DispatchData : public CommonDispatchData {};
59 bool Validate(const Params&, const optional_params&) const override;
60 virtual JitConstants GetJitConstants(const lookup_table_params& params) const;
61 virtual DispatchData SetDefault(const lookup_table_params& params) const;
62 KernelsData GetCommonKernelsData(const Params& params, const optional_params&, float estimatedTime) const;
64 } // namespace kernel_selector