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
24 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
26 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
27 struct batch_norm_params : public base_params
29 batch_norm_params() : base_params(KernelType::BATCH_NORM_GRAD) {}
31 struct DedicatedParams
35 bool with_scale_shift;
36 bool with_mean_var_out = false;
39 DedicatedParams batchNormParams;
41 virtual ParamsKey GetParamsKey() const
43 return base_params::GetParamsKey();
47 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
48 // batch_norm_optional_params
49 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
50 struct batch_norm_optional_params : optional_params
52 batch_norm_optional_params() : optional_params(KernelType::BATCH_NORM_GRAD) {}
55 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
56 // BatchNormKernelBase
57 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
58 class BatchNormKernelBase : public common_kernel_base
61 using common_kernel_base::common_kernel_base;
62 virtual ~BatchNormKernelBase() {}
64 using DispatchData = CommonDispatchData;
67 virtual bool Validate(const Params& params, const optional_params& options) const override;
68 KernelsData GetCommonKernelsData(const Params& params, const optional_params&, float estimatedTime) const;
69 virtual JitConstants GetJitConstants(const batch_norm_params& params) const;
70 virtual DispatchData SetDefault(const batch_norm_params& params) const;