Publishing 2019 R1 content
[platform/upstream/dldt.git] / inference-engine / thirdparty / clDNN / kernel_selector / core / actual_kernels / convolution / convolution_params.cpp
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 #include "convolution_params.h"
18 #include <sstream>
19
20 namespace kernel_selector
21 {
22     std::string convolution_params::to_string() const
23     {
24         std::stringstream s;
25
26         s << base_params::to_string() << "_";
27         if (bias.empty())
28         {
29             s << "no_bias" << "_";
30         }
31         else
32         {
33             s << "bias_" << bias[0].PhysicalSize() << "_";
34         }
35         s << filterSize.x << "_" << filterSize.y << "_";
36         s << stride.x << "_" << stride.y << "_";
37         s << dilation.x << "_" << dilation.y << "_";
38         s << padding.x << "_" << padding.y << "_";
39         s << split;
40
41         return s.str();
42     }
43
44     ParamsKey convolution_params::GetParamsKey() const
45     {
46         ParamsKey k = weight_bias_params::GetParamsKey();
47
48         if (split > 1)
49         {
50             k.EnableSplitSupport();
51         }
52
53         if (dilation.x != 1 ||
54             dilation.y != 1)
55         {
56             k.EnableDilation();
57         }
58
59         if (depthwise_separable_opt)
60         {
61             k.EnableDepthwiseSeparableOpt();
62         }
63
64         if (transposed)
65         {
66             k.EnableTranspose();
67         }
68
69         if (int8_quantization)
70         {
71             k.EnableInt8Quantization();
72         }
73
74         if (output_calibration)
75         {
76             k.EnableOutputCalibration();
77         }
78
79         if (local_convolution)
80         {
81             k.EnableLocalConvolution();
82         }
83
84         if (groups > 1 && !depthwise_separable_opt)
85         {
86             k.EnableGroupedConvolution();
87         }
88
89         return k;
90     }
91 }