1 // Copyright (c) 2016 Intel Corporation
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
18 #include "common_kernel_base.h"
20 namespace kernel_selector {
21 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
23 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
24 struct activation_params : public base_params {
25 activation_params() : base_params(KernelType::ACTIVATION) {}
27 MultiDataTensor inputActivationParams;
29 virtual ParamsKey GetParamsKey() const {
30 auto k = base_params::GetParamsKey();
31 if (!inputActivationParams.empty()) {
32 k.EnableActivationAdditionalParamsAsInput();
38 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
39 // activation_optional_params
40 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
41 struct activation_optional_params : optional_params {
42 activation_optional_params() : optional_params(KernelType::ACTIVATION) {}
45 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
46 // ActivationKernelBase
47 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
48 class ActivationKernelBase : public common_kernel_base {
50 using DispatchData = CommonDispatchData;
51 using common_kernel_base::common_kernel_base;
53 virtual ~ActivationKernelBase() {}
56 bool Validate(const Params& p, const optional_params& o) const override;
57 virtual JitConstants GetJitConstants(const activation_params& params, DispatchData kd) const;
58 virtual DispatchData SetDefault(const activation_params& arg) const;
59 KernelsData GetCommonKernelsData(const Params& params, const optional_params& options) const;
61 } // namespace kernel_selector