2 // Copyright (c) 2016 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.
17 ///////////////////////////////////////////////////////////////////////////////////////////////////
22 /// @addtogroup c_api C API
24 /// @addtogroup c_topology Network Topology
26 /// @addtogroup c_primitives Primitives
33 /// @brief Performs forward spatial convolution with weight sharing.
34 /// Also supports built-in Relu @CLDNN_PRIMITIVE_DESC{activation} available by setting it in arguments.
35 /// @details Parameters are defined in context of "direct" convolution, but actual algorithm is not implied.
36 CLDNN_BEGIN_PRIMITIVE_DESC(convolution)
37 /// @brief Defines a shift, relative to (0,0) position of the input buffer, where (0,0) point of the convolution window should start calculations.
38 cldnn_tensor input_offset;
39 /// @brief Defines shift in input buffer between adjacent calculations of output values.
41 /// @brief Defines gaps in the input - dilation rate k=1 is normal convolution, k=2 means skipping one pixel per input, k=4 means skipping 3 pixels.
42 /// As an example in one dimension, a filter w of size 3 would compute over input x the following: w[0]*x[0] + w[1]*x[1] + w[2]*x[2] for dilation of 1.
43 /// For dilation 2 the filter would instead compute w[0]*x[0] + w[1]*x[2] + w[2]*x[4].
44 cldnn_tensor dilation;
45 /// @brief Enable Relu activation.
46 uint32_t with_activation;
47 /// @brief Relu activation slope.
48 float activation_negative_slope;
49 /// @brief On how many cards split the computation to.
51 /// @brief Indicates that the primitive has user-defined output size (non-zero value).
52 uint32_t with_output_size;
53 /// @brief User-defined output data size of the primitive (w/o padding).
54 cldnn_tensor output_size;
55 /// @brief Array of primitive ids containing weights data. Size of array should be equivalent to @p split.
56 cldnn_primitive_id_arr weights;
57 /// @brief Array of primitive ids containing bias data. Size of array should be equivalent to @p split.
58 cldnn_primitive_id_arr bias;
59 /// @brief List of primitive ids containing weights quanitization factors per output feature map.
60 cldnn_primitive_id_arr weights_quantization_factors;
61 /// @brief List of primitive ids containing output calibration factors per output feature map.
62 cldnn_primitive_id_arr output_calibration_factors;
63 /// @brief Input quantization factor
64 float input_quantization_factor;
65 /// @brief Output quantization factor
66 float output_quantization_factor;
67 /// @brief Number of feature groups (grouped convolution). If more than 1 then weights/bias count needs to be 1.
69 /// @param padding_above Defines a padding added to input image on left (x axis) and top (y axis).
70 cldnn_tensor padding_above;
71 /// @param padding_below Defines a padding added to input image on right (x axis) and bottom (y axis).
72 cldnn_tensor padding_below;
74 CLDNN_END_PRIMITIVE_DESC(convolution)
76 CLDNN_DECLARE_PRIMITIVE_TYPE_ID(convolution);
85 #endif /* CONVOLUTION_H */