Publishing 2019 R1 content
[platform/upstream/dldt.git] / inference-engine / thirdparty / clDNN / api / C / eltwise.h
1 /*
2 // Copyright (c) 2016-2019 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 ELTWISE_H
19 #define ELTWISE_H
20
21 #include "cldnn.h"
22 /// @addtogroup c_api C API
23 /// @{
24 /// @addtogroup c_topology Network Topology
25 /// @{
26 /// @addtogroup c_primitives Primitives
27 /// @{
28
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32
33 /// @brief Select mode for eltwise layer ( @CLDNN_PRIMITIVE_DESC{eltwise} ​).
34 typedef enum /*:int32_t*/
35 {
36     /// @brief Eltwise sum.
37     cldnn_eltwise_sum,
38     /// @brief Eltwise subtract.
39     cldnn_eltwise_sub,
40     /// @brief Eltwise max.
41     cldnn_eltwise_max,
42     /// @brief Eltwise product (Hadamard).
43     cldnn_eltwise_prod,
44     /// @brief Eltwise div.
45     cldnn_eltwise_div,
46     /// @brief Eltwise min.
47     cldnn_eltwise_min,
48     /// @brief Eltwise pow.
49     cldnn_eltwise_pow,
50     /// @brief Eltwise mod.
51     cldnn_eltwise_mod,
52     /// @brief Eltwise equal.
53     cldnn_eltwise_eq,
54     /// @brief Eltwise not equal.
55     cldnn_eltwise_ne,
56     /// @brief Eltwise less.
57     cldnn_eltwise_lt,
58     /// @brief Eltwise less of equal.
59     cldnn_eltwise_le,
60     /// @brief Eltwise greater.
61     cldnn_eltwise_gt,
62     /// @brief Eltwise greater or equal.
63     cldnn_eltwise_ge,
64     /// @brief Eltwise and.
65     cldnn_eltwise_and,
66     /// @brief Eltwise or.
67     cldnn_eltwise_or,
68     /// @brief Eltwise xor.
69     cldnn_eltwise_xor,
70     /// @brief Eltwise squared diff.
71     cldnn_eltwise_squared_diff
72 } cldnn_eltwise_mode;
73
74 /// @brief Performs elementwise operations (sum, subtract, max or product) on two input primitives
75 /// Also supports built-in Relu @CLDNN_PRIMITIVE_DESC{activation} available by setting it in arguments.
76 /// @notes
77 /// - both inputs have to have equal sizes in all dimensions or the input tensors are broadcastable
78 ///   to the same shape in which the size of each dimention is a max. of input sizes on this dimension)
79 /// - format of both inputs has to be the same
80 /// - when using integer types, only following eltwise modes are supported: sum, sub, prod, div
81 CLDNN_BEGIN_PRIMITIVE_DESC(eltwise)
82 /// @brief Primitive id containing output quanitization factors per output feature map.
83 cldnn_primitive_id output_calibration_factors;
84 /// @brief Output quantization factor
85 float output_quantization_factor;
86 /// @brief Eltwise mode. See #cldnn_eltwise_mode.
87 int32_t mode; /*cldnn_eltwise_mode*/
88 /// @brief Blob-wise coefficient for SUM operation
89 cldnn_float_arr coefficients;
90 /// @brief Enables Relu activation.
91 uint32_t with_activation;
92 /// @brief Relu activation slope.
93 float activation_negative_slope;
94 /// @brief Defines shift in input buffers between adjacent calculations of output values.
95 cldnn_tensor_arr stride;
96
97 CLDNN_END_PRIMITIVE_DESC(eltwise)
98
99 CLDNN_DECLARE_PRIMITIVE_TYPE_ID(eltwise);
100
101 #ifdef __cplusplus
102 }
103 #endif
104
105 /// @}
106 /// @}
107 /// @}
108 #endif /* ELTWISE_H */
109