1 /** 2 * Copyright 2021 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 /** 18 * @addtogroup MindSpore 19 * @{ 20 * 21 * @brief 提供MindSpore Lite的模型推理相关接口。 22 * 23 * @Syscap SystemCapability.Ai.MindSpore 24 * @since 9 25 */ 26 27 /** 28 * @file status.h 29 * 30 * @brief 提供了Mindspore Lite运行时的状态码。 31 * 32 * @library libmindspore_lite_ndk.so 33 * @since 9 34 */ 35 #ifndef MINDSPORE_INCLUDE_C_API_STATUS_C_H 36 #define MINDSPORE_INCLUDE_C_API_STATUS_C_H 37 38 #include <stdint.h> 39 40 #ifdef __cplusplus 41 extern "C" { 42 #endif 43 44 enum OH_AI_CompCode { 45 OH_AI_COMPCODE_CORE = 0x00000000u, 46 OH_AI_COMPCODE_MD = 0x10000000u, 47 OH_AI_COMPCODE_ME = 0x20000000u, 48 OH_AI_COMPCODE_MC = 0x30000000u, 49 OH_AI_COMPCODE_LITE = 0xF0000000u, 50 }; 51 52 typedef enum OH_AI_Status { 53 OH_AI_STATUS_SUCCESS = 0, 54 // Core 55 OH_AI_STATUS_CORE_FAILED = OH_AI_COMPCODE_CORE | 0x1, 56 57 // Lite // Common error code, range: [-1, -100) 58 OH_AI_STATUS_LITE_ERROR = OH_AI_COMPCODE_LITE | (0x0FFFFFFF & -1), /**< Common error code. */ 59 OH_AI_STATUS_LITE_NULLPTR = OH_AI_COMPCODE_LITE | (0x0FFFFFFF & -2), /**< NULL pointer returned.*/ 60 OH_AI_STATUS_LITE_PARAM_INVALID = OH_AI_COMPCODE_LITE | (0x0FFFFFFF & -3), /**< Invalid parameter.*/ 61 OH_AI_STATUS_LITE_NO_CHANGE = OH_AI_COMPCODE_LITE | (0x0FFFFFFF & -4), /**< No change. */ 62 OH_AI_STATUS_LITE_SUCCESS_EXIT = OH_AI_COMPCODE_LITE | (0x0FFFFFFF & -5), /**< No error but exit. */ 63 OH_AI_STATUS_LITE_MEMORY_FAILED = OH_AI_COMPCODE_LITE | (0x0FFFFFFF & -6), /**< Fail to create memory. */ 64 OH_AI_STATUS_LITE_NOT_SUPPORT = OH_AI_COMPCODE_LITE | (0x0FFFFFFF & -7), /**< Fail to support. */ 65 OH_AI_STATUS_LITE_THREADPOOL_ERROR = OH_AI_COMPCODE_LITE | (0x0FFFFFFF & -8), /**< Error occur in thread pool. */ 66 OH_AI_STATUS_LITE_UNINITIALIZED_OBJ = OH_AI_COMPCODE_LITE | (0x0FFFFFFF & -9), /**< Object is not initialized. */ 67 68 // Executor error code, range: [-100,-200) 69 OH_AI_STATUS_LITE_OUT_OF_TENSOR_RANGE = OH_AI_COMPCODE_LITE | (0x0FFFFFFF & -100), /**< Failed to check range. */ 70 OH_AI_STATUS_LITE_INPUT_TENSOR_ERROR = 71 OH_AI_COMPCODE_LITE | (0x0FFFFFFF & -101), /**< Failed to check input tensor. */ 72 OH_AI_STATUS_LITE_REENTRANT_ERROR = OH_AI_COMPCODE_LITE | (0x0FFFFFFF & -102), /**< Exist executor running. */ 73 74 // Graph error code, range: [-200,-300) 75 OH_AI_STATUS_LITE_GRAPH_FILE_ERROR = OH_AI_COMPCODE_LITE | (0x0FFFFFFF & -200), /**< Failed to verify graph file. */ 76 77 // Node error code, range: [-300,-400) 78 OH_AI_STATUS_LITE_NOT_FIND_OP = OH_AI_COMPCODE_LITE | (0x0FFFFFFF & -300), /**< Failed to find operator. */ 79 OH_AI_STATUS_LITE_INVALID_OP_NAME = OH_AI_COMPCODE_LITE | (0x0FFFFFFF & -301), /**< Invalid operator name. */ 80 OH_AI_STATUS_LITE_INVALID_OP_ATTR = OH_AI_COMPCODE_LITE | (0x0FFFFFFF & -302), /**< Invalid operator attr. */ 81 OH_AI_STATUS_LITE_OP_EXECUTE_FAILURE = 82 OH_AI_COMPCODE_LITE | (0x0FFFFFFF & -303), /**< Failed to execution operator. */ 83 84 // Tensor error code, range: [-400,-500) 85 OH_AI_STATUS_LITE_FORMAT_ERROR = OH_AI_COMPCODE_LITE | (0x0FFFFFFF & -400), /**< Failed to checking tensor format. */ 86 87 // InferShape error code, range: [-500,-600) 88 OH_AI_STATUS_LITE_INFER_ERROR = OH_AI_COMPCODE_LITE | (0x0FFFFFFF & -500), /**< Failed to infer shape. */ 89 OH_AI_STATUS_LITE_INFER_INVALID = 90 OH_AI_COMPCODE_LITE | (0x0FFFFFFF & -501), /**< Invalid infer shape before runtime. */ 91 92 // User input param error code, range: [-600, 700) 93 OH_AI_STATUS_LITE_INPUT_PARAM_INVALID = 94 OH_AI_COMPCODE_LITE | (0x0FFFFFFF & -600), /**< Invalid input param by user. */ 95 } OH_AI_Status; 96 #ifdef __cplusplus 97 } 98 #endif 99 #endif // MINDSPORE_INCLUDE_C_API_STATUS_C_H 100