• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright 2022 Huawei Technologies Co., Ltd
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 MINDSPORE_CCSRC_C_API_INCLUDE_ABSTRACT_H_
18 #define MINDSPORE_CCSRC_C_API_INCLUDE_ABSTRACT_H_
19 
20 #include <stdlib.h>
21 #include "include/c_api/ms/base/macros.h"
22 #include "include/c_api/ms/base/types.h"
23 #include "include/c_api/ms/base/handle_types.h"
24 #include "include/c_api/ms/base/status.h"
25 #include "include/c_api/ms/context.h"
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 /// \brief Assign Abstract from the input node to the current node.
32 ///
33 /// \param[in] res_mgr Resource manager that saves allocated instance resources.
34 /// \param[in] cur_node The current node.
35 /// \param[in] input_node The input node which contains the Abstract.
36 ///
37 /// \return Error code indicates whether the function executed successfully.
38 MIND_C_API STATUS MSAssignAbstract(ResMgrHandle res_mgr, NodeHandle cur_node, ConstNodeHandle input_node);
39 
40 /// \brief Set Abstract to the node with type and shape.
41 ///
42 /// \param[in] res_mgr Resource manager that saves allocated instance resources.
43 /// \param[in] node The target node.
44 /// \param[in] type The output type of the node.
45 /// \param[in] shape The shape array which describe the output shape of node.
46 /// \param[in] shape_size The size of the shape array, i.e., the dimension of node output.
47 ///
48 /// \return Error code indicates whether the function executed successfully.
49 MIND_C_API STATUS MSSetAbstract(ResMgrHandle res_mgr, NodeHandle node, DataTypeC type, const int64_t shape[],
50                                 size_t shape_size);
51 
52 /// \brief Get multiple Abstract to the node. Usually used in the case that the node has multiple outputs.
53 ///
54 /// \param[in] res_mgr Resource manager that saves allocated instance resources.
55 /// \param[in] node The target node.
56 /// \param[in] type The output type of the node.
57 /// \param[in] shapes A 2D array which contains multiple shape arrays response to node's multiple outputs.
58 /// \param[in] shape_sizes The array contains the size of all shape, i.e., the dimension of all node output.
59 ///
60 /// \return Error code indicates whether the function executed successfully.
61 MIND_C_API STATUS MSSetMultiAbstract(ResMgrHandle res_mgr, NodeHandle node, DataTypeC type, const int64_t **shapes,
62                                      const size_t shape_sizes[], size_t abs_num);
63 
64 #ifdef __cplusplus
65 }
66 #endif
67 #endif  // MINDSPORE_CCSRC_C_API_INCLUDE_ABSTRACT_H_
68