2 // Copyright (c) 2019 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.
20 #include "common_kernel_base.h"
22 namespace kernel_selector
24 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
26 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
27 struct roi_pooling_params : public base_params
29 roi_pooling_params() : base_params(KernelType::ROI_POOLING) {}
31 PoolType mode = PoolType::MAX;
32 bool position_sensitive = false;
35 int spatial_bins_x = 1;
36 int spatial_bins_y = 1;
37 float spatialScale = 1.f;
39 virtual ParamsKey GetParamsKey() const
41 auto k = base_params::GetParamsKey();
42 if (position_sensitive)
44 k.EnablePositionSensitivePooling();
46 k.EnablePoolType(mode);
52 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
53 // roi_pooling_optional_params
54 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
55 struct roi_pooling_optional_params : optional_params
57 roi_pooling_optional_params() : optional_params(KernelType::ROI_POOLING) {}
60 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
61 // ROIPoolingKernelBase
62 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
63 class ROIPoolingKernelBase : public common_kernel_base
66 using common_kernel_base::common_kernel_base;
67 virtual ~ROIPoolingKernelBase() {};
69 using DispatchData = CommonDispatchData;
71 KernelsData GetCommonKernelsData(const Params& params, const optional_params& options, float estimatedTime) const;
73 virtual JitConstants GetJitConstants(const roi_pooling_params& params) const;