2 // Copyright (c) 2016 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"
21 namespace kernel_selector
23 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
25 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
26 struct activation_params : public base_params
28 activation_params() : base_params(KernelType::ACTIVATION) {}
30 MultiDataTensor inputActivationParams;
32 virtual ParamsKey GetParamsKey() const
34 auto k = base_params::GetParamsKey();
35 if (!inputActivationParams.empty())
37 k.EnableActivationAdditionalParamsAsInput();
43 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
44 // activation_optional_params
45 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
46 struct activation_optional_params : optional_params
48 activation_optional_params() : optional_params(KernelType::ACTIVATION) {}
51 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
52 // ActivationKernelBase
53 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
54 class ActivationKernelBase : public common_kernel_base
57 using DispatchData = CommonDispatchData;
58 using common_kernel_base::common_kernel_base;
60 virtual ~ActivationKernelBase() {}
63 virtual bool Validate(const Params& p, const optional_params& o) const override;
64 virtual JitConstants GetJitConstants(const activation_params& params, DispatchData kd) const;
65 virtual DispatchData SetDefault(const activation_params& arg) const;
66 KernelsData GetCommonKernelsData(const Params& params, const optional_params& options) const;