Publishing 2019 R1 content
[platform/upstream/dldt.git] / inference-engine / thirdparty / clDNN / api / C / convolution_grad_weights.h
1 /*
2 // Copyright (c) 2018 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 ///////////////////////////////////////////////////////////////////////////////////////////////////
18 #ifndef CONVOLUTION_GRAD_WEIGHTS_H
19 #define CONVOLUTION_GRAD_WEIGHTS_H
20
21 #include <stdbool.h>
22 #include "cldnn.h"
23 /// @addtogroup c_api C API
24 /// @{
25 /// @addtogroup c_topology Network Topology
26 /// @{
27 /// @addtogroup c_primitives Primitives
28 /// @{
29
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33
34 /// @brief Performs backward convolution operation for weights and biases.
35 /// @details convolution_grad_weights updates weights and bias mutable data for training purposes.
36 /// @details Please note that this primitive was not heavily tested and currently only batch=1 is enabled for this primitive.
37 CLDNN_BEGIN_PRIMITIVE_DESC(convolution_grad_weights)
38 /// @brief Defines a shift, relative to (0,0) position of the input buffer, where (0,0) point of the convolution_grad_weights window should start calculations.
39 cldnn_tensor input_offset;
40 /// @brief Defines the spatial dimensions of stride of adjacent elements in input buffer.
41 cldnn_tensor stride;
42 /// @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.
43 /// 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. 
44 /// For dilation 2 the filter would instead compute w[0]*x[0] + w[1]*x[2] + w[2]*x[4].
45 cldnn_tensor dilation;
46 /// @brief On how many cards split the computation to.
47 uint32_t split;
48 /// @brief Array of primitive ids containing weights data. Size of array should be equivalent to @p split.
49 cldnn_primitive_id_arr weights;
50 /// @brief Array of primitive ids containing bias data. Size of array should be equivalent to @p split or should be empty (if not using bias).
51 cldnn_primitive_id_arr bias;
52 /// @brief Primitive id containing convolution gradient data. Used for proper order of gradient calculation. Leave empty if primitive is last in backward pass.
53 cldnn_primitive_id conv_grad;
54 /// @brief Array of primitive ids containing weights gradient data calculated in previous iteration. Amount of primitives and their memory sizes should be same as weights.
55 cldnn_primitive_id_arr prev_weights_grad;
56 /// @brief Array of primitive ids containing bias gradient data calculated in previous iteration. Amount of primitives and their memory sizes should be same as biases.
57 cldnn_primitive_id_arr prev_bias_grad;
58 /// @brief Should primitive give weights gradient (delta) as an output
59 bool output_grad_w;
60
61 CLDNN_END_PRIMITIVE_DESC(convolution_grad_weights)
62
63 CLDNN_DECLARE_PRIMITIVE_TYPE_ID(convolution_grad_weights);
64
65 #ifdef __cplusplus
66 }
67 #endif
68
69 /// @}
70 /// @}
71 /// @}
72 #endif /* CONVOLUTION_GRAD_WEIGHTS_H */
73