1 // Copyright (c) 2019 Intel Corporation
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 ///////////////////////////////////////////////////////////////////////////////////////////////////
22 /// @addtogroup c_api C API
24 /// @addtogroup c_topology Network Topology
26 /// @addtogroup c_primitives Primitives
33 /// @brief Select reduction operation for contract layer ( @CLDNN_PRIMITIVE_DESC{contract} ?).
34 typedef enum /*:int32_t*/
36 /// @brief Sum reduction.
38 /// @brief Product reduction.
39 cldnn_contract_product,
40 /// @brief All reduction.
42 /// @brief Any reduction.
44 /// @brief Max reduction.
46 } cldnn_contract_mode;
48 /// @brief Reduces input with an operation defined by @p mode along defined
49 /// by @p reduction_axes dimensions.
51 /// @details Reduces the input using the binary operation determined by
52 /// @p mode. The @p reduction_axes determine the final shape of the
53 /// output, which is calculated based on the input shape by
54 /// collapsing the dimensions along which the reduction happens.
55 /// For example, for the input with
56 /// @n <tt>input_sizes = (in_b, in_f, in_y, in_x)</tt>
57 /// @n a reduction with
58 /// @n <tt>reduction_axes = (2)</tt>
59 /// @n would collapse the Y dimension, producing
60 /// @n <tt>output_shape = (1, in_b, in_f, in_x)</tt>
61 /// @n where every element is a @p mode reduction of the input elements with
62 /// @n the same B, F and X coordinates.
64 /// @n@b Requirements:
65 /// @n - @p reduction_axes size (dimensions count) must be within (inclusive) range
67 /// @n - @p reduction_axes mustn't have duplicate values.
68 /// @n - Values of @p reduction_axes must be within (inclusive) range 0 - 3
69 /// @n Breaking any of these conditions will raise an exception.
70 CLDNN_BEGIN_PRIMITIVE_DESC(contract)
71 /// @brief Reduction mode. See #cldnn_contract_mode.
72 int32_t mode; /*cldnn_contract_mode*/
73 /// @brief Array of axes positions from input shape (0-based, from left to right)
74 /// along which reduction should happen.
75 cldnn_uint16_t_arr reduction_axes;
77 CLDNN_END_PRIMITIVE_DESC(contract)
80 CLDNN_DECLARE_PRIMITIVE_TYPE_ID(contract);