• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright 2020 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_LITE_INCLUDE_ERRORCODE_H_
18 #define MINDSPORE_LITE_INCLUDE_ERRORCODE_H_
19 
20 #include <string>
21 
22 namespace mindspore {
23 namespace lite {
24 /// \brief STATUS defined for holding error code in MindSpore Lite.
25 using STATUS = int;
26 
27 /* Success */
28 constexpr int RET_OK = 0; /**< No error occurs. */
29 
30 /* Common error code, range: [-1, -100) */
31 constexpr int RET_ERROR = -1;             /**< Common error code. */
32 constexpr int RET_NULL_PTR = -2;          /**< NULL pointer returned.*/
33 constexpr int RET_PARAM_INVALID = -3;     /**< Invalid parameter.*/
34 constexpr int RET_NO_CHANGE = -4;         /**< No change. */
35 constexpr int RET_SUCCESS_EXIT = -5;      /**< No error but exit. */
36 constexpr int RET_MEMORY_FAILED = -6;     /**< Fail to create memory. */
37 constexpr int RET_NOT_SUPPORT = -7;       /**< Fail to support. */
38 constexpr int RET_THREAD_POOL_ERROR = -8; /**< Error occur in thread pool. */
39 
40 /* Executor error code, range: [-100,-200) */
41 constexpr int RET_OUT_OF_TENSOR_RANGE = -100; /**< Failed to check range. */
42 constexpr int RET_INPUT_TENSOR_ERROR = -101;  /**< Failed to check input tensor. */
43 constexpr int RET_REENTRANT_ERROR = -102;     /**< Exist executor running. */
44 
45 /* Graph error code, range: [-200,-300) */
46 constexpr int RET_GRAPH_FILE_ERR = -200; /**< Failed to verify graph file. */
47 
48 /* Node error code, range: [-300,-400) */
49 constexpr int RET_NOT_FIND_OP = -300;        /**< Failed to find operator. */
50 constexpr int RET_INVALID_OP_NAME = -301;    /**< Invalid operator name. */
51 constexpr int RET_INVALID_OP_ATTR = -302;    /**< Invalid operator attr. */
52 constexpr int RET_OP_EXECUTE_FAILURE = -303; /**< Failed to execution operator. */
53 
54 /* Tensor error code, range: [-400,-500) */
55 constexpr int RET_FORMAT_ERR = -400; /**< Failed to checking tensor format. */
56 
57 /* InferShape error code, range: [-500,-600) */
58 constexpr int RET_INFER_ERR = -500;     /**< Failed to infer shape. */
59 constexpr int RET_INFER_INVALID = -501; /**< Invalid infer shape before runtime. */
60 
61 /* User input param error code, range: [-600, 700) */
62 constexpr int RET_INPUT_PARAM_INVALID = -600; /**< Invalid input param by user. */
63 
64 /// \brief Print description of errorcode.
65 ///
66 /// \param[in] error_code define return status of procedure.
67 ///
68 /// \return String of errorcode info.
69 std::string GetErrorInfo(STATUS error_code);
70 
71 }  // namespace lite
72 }  // namespace mindspore
73 
74 #endif  // MINDSPORE_LITE_INCLUDE_ERRORCODE_H_
75