Imported Upstream version 1.12.0
[platform/core/ml/nnfw.git] / compiler / luci / service / include / luci / Service / CircleShapeSignatureInferenceHelper.h
1 /*
2  * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
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 #ifndef __LUCI_CIRCLE_SHAPE_SIGNATURE_INFERENCE_HELPER_H__
18 #define __LUCI_CIRCLE_SHAPE_SIGNATURE_INFERENCE_HELPER_H__
19
20 #include <luci/IR/CircleNodes.h>
21 #include <luci/IR/CircleShapeSignature.h>
22
23 namespace luci
24 {
25
26 namespace ssinf // Namespace for Shape Signature Inference
27 {
28
29 // Return empty signature if all of dimensions are known.
30 // If at least one of dimensions is unknown, return signature without change.
31 ShapeSignature legalized_signature(const luci::ShapeSignature &signature);
32
33 // Return reduced input_signature with indices and keep_dims.
34 //  - indices : reduction index
35 //  - keep_dims : If true, rank is not changed. If false, rank is reduced along indices.
36 ShapeSignature reduced_signature(const loco::Node *node, const loco::Node *indices, bool keep_dims);
37
38 // Return signature of index-th argument of node.
39 ShapeSignature input_arg_signature(const luci::CircleNode *node, uint32_t index);
40
41 } // namespace ssinf
42
43 } // namespace luci
44
45 #endif // __LUCI_CIRCLE_SHAPE_SIGNATURE_INFERENCE_HELPER_H__