Publishing R3
[platform/upstream/dldt.git] / inference-engine / thirdparty / clDNN / kernel_selector / core / actual_kernels / activation / activation_kernel_base.h
1 /*
2 // Copyright (c) 2016 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
21 namespace kernel_selector
22 {
23     ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
24     // activation_params
25     ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
26     struct activation_params : public base_params
27     {
28         activation_params() : base_params(KernelType::ACTIVATION) {}
29
30         MultiDataTensor inputActivationParams;
31
32         virtual ParamsKey GetParamsKey() const
33         {
34             auto k = base_params::GetParamsKey();
35             if (!inputActivationParams.empty())
36             {
37                 k.EnableActivationAdditionalParamsAsInput();
38             }
39             return k;
40         }
41     };
42
43     ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
44     // activation_optional_params
45     ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
46     struct activation_optional_params : optional_params
47     {
48         activation_optional_params() : optional_params(KernelType::ACTIVATION) {}
49     };
50
51     ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
52     // ActivationKernelBase
53     ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
54     class ActivationKernelBase : public common_kernel_base
55     {
56     public:
57         using DispatchData = CommonDispatchData;
58         using common_kernel_base::common_kernel_base;
59         
60         virtual ~ActivationKernelBase() {}
61
62     protected:
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;
67     };
68 }