17777dab0Sopenharmony_ci/**
27777dab0Sopenharmony_ci * Copyright 2021 Huawei Technologies Co., Ltd
37777dab0Sopenharmony_ci *
47777dab0Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
57777dab0Sopenharmony_ci * you may not use this file except in compliance with the License.
67777dab0Sopenharmony_ci * You may obtain a copy of the License at
77777dab0Sopenharmony_ci *
87777dab0Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0
97777dab0Sopenharmony_ci *
107777dab0Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
117777dab0Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
127777dab0Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
137777dab0Sopenharmony_ci * See the License for the specific language governing permissions and
147777dab0Sopenharmony_ci * limitations under the License.
157777dab0Sopenharmony_ci */
167777dab0Sopenharmony_ci
177777dab0Sopenharmony_ci/**
187777dab0Sopenharmony_ci * @addtogroup MindSpore
197777dab0Sopenharmony_ci * @{
207777dab0Sopenharmony_ci *
217777dab0Sopenharmony_ci * @brief 提供MindSpore Lite的模型推理相关接口。
227777dab0Sopenharmony_ci *
237777dab0Sopenharmony_ci * @Syscap SystemCapability.Ai.MindSpore
247777dab0Sopenharmony_ci * @since 9
257777dab0Sopenharmony_ci */
267777dab0Sopenharmony_ci
277777dab0Sopenharmony_ci/**
287777dab0Sopenharmony_ci * @file status.h
297777dab0Sopenharmony_ci * @kit MindSporeLiteKit
307777dab0Sopenharmony_ci * @brief 提供了Mindspore Lite运行时的状态码。
317777dab0Sopenharmony_ci *
327777dab0Sopenharmony_ci * @library libmindspore_lite_ndk.so
337777dab0Sopenharmony_ci * @since 9
347777dab0Sopenharmony_ci */
357777dab0Sopenharmony_ci#ifndef MINDSPORE_INCLUDE_C_API_STATUS_C_H
367777dab0Sopenharmony_ci#define MINDSPORE_INCLUDE_C_API_STATUS_C_H
377777dab0Sopenharmony_ci
387777dab0Sopenharmony_ci#include <stdint.h>
397777dab0Sopenharmony_ci
407777dab0Sopenharmony_ci#ifdef __cplusplus
417777dab0Sopenharmony_ciextern "C" {
427777dab0Sopenharmony_ci#endif
437777dab0Sopenharmony_ci
447777dab0Sopenharmony_cienum OH_AI_CompCode {
457777dab0Sopenharmony_ci  OH_AI_COMPCODE_CORE = 0x00000000u,
467777dab0Sopenharmony_ci  OH_AI_COMPCODE_MD = 0x10000000u,
477777dab0Sopenharmony_ci  OH_AI_COMPCODE_ME = 0x20000000u,
487777dab0Sopenharmony_ci  OH_AI_COMPCODE_MC = 0x30000000u,
497777dab0Sopenharmony_ci  OH_AI_COMPCODE_LITE = 0xF0000000u,
507777dab0Sopenharmony_ci};
517777dab0Sopenharmony_ci
527777dab0Sopenharmony_citypedef enum OH_AI_Status {
537777dab0Sopenharmony_ci  OH_AI_STATUS_SUCCESS = 0,
547777dab0Sopenharmony_ci  // Core
557777dab0Sopenharmony_ci  OH_AI_STATUS_CORE_FAILED = OH_AI_COMPCODE_CORE | 0x1,
567777dab0Sopenharmony_ci
577777dab0Sopenharmony_ci  // Lite  // Common error code, range: [-1, -100)
587777dab0Sopenharmony_ci  OH_AI_STATUS_LITE_ERROR = OH_AI_COMPCODE_LITE | (0x0FFFFFFF & -1),             /**< Common error code. */
597777dab0Sopenharmony_ci  OH_AI_STATUS_LITE_NULLPTR = OH_AI_COMPCODE_LITE | (0x0FFFFFFF & -2),           /**< NULL pointer returned.*/
607777dab0Sopenharmony_ci  OH_AI_STATUS_LITE_PARAM_INVALID = OH_AI_COMPCODE_LITE | (0x0FFFFFFF & -3),     /**< Invalid parameter.*/
617777dab0Sopenharmony_ci  OH_AI_STATUS_LITE_NO_CHANGE = OH_AI_COMPCODE_LITE | (0x0FFFFFFF & -4),         /**< No change. */
627777dab0Sopenharmony_ci  OH_AI_STATUS_LITE_SUCCESS_EXIT = OH_AI_COMPCODE_LITE | (0x0FFFFFFF & -5),      /**< No error but exit. */
637777dab0Sopenharmony_ci  OH_AI_STATUS_LITE_MEMORY_FAILED = OH_AI_COMPCODE_LITE | (0x0FFFFFFF & -6),     /**< Fail to create memory. */
647777dab0Sopenharmony_ci  OH_AI_STATUS_LITE_NOT_SUPPORT = OH_AI_COMPCODE_LITE | (0x0FFFFFFF & -7),       /**< Fail to support. */
657777dab0Sopenharmony_ci  OH_AI_STATUS_LITE_THREADPOOL_ERROR = OH_AI_COMPCODE_LITE | (0x0FFFFFFF & -8),  /**< Error occur in thread pool. */
667777dab0Sopenharmony_ci  OH_AI_STATUS_LITE_UNINITIALIZED_OBJ = OH_AI_COMPCODE_LITE | (0x0FFFFFFF & -9), /**< Object is not initialized. */
677777dab0Sopenharmony_ci
687777dab0Sopenharmony_ci  // Executor error code, range: [-100,-200)
697777dab0Sopenharmony_ci  OH_AI_STATUS_LITE_OUT_OF_TENSOR_RANGE = OH_AI_COMPCODE_LITE | (0x0FFFFFFF & -100), /**< Failed to check range. */
707777dab0Sopenharmony_ci  OH_AI_STATUS_LITE_INPUT_TENSOR_ERROR =
717777dab0Sopenharmony_ci    OH_AI_COMPCODE_LITE | (0x0FFFFFFF & -101),                                   /**< Failed to check input tensor. */
727777dab0Sopenharmony_ci  OH_AI_STATUS_LITE_REENTRANT_ERROR = OH_AI_COMPCODE_LITE | (0x0FFFFFFF & -102), /**< Exist executor running. */
737777dab0Sopenharmony_ci
747777dab0Sopenharmony_ci  // Graph error code, range: [-200,-300)
757777dab0Sopenharmony_ci  OH_AI_STATUS_LITE_GRAPH_FILE_ERROR = OH_AI_COMPCODE_LITE | (0x0FFFFFFF & -200), /**< Failed to verify graph file. */
767777dab0Sopenharmony_ci
777777dab0Sopenharmony_ci  // Node error code, range: [-300,-400)
787777dab0Sopenharmony_ci  OH_AI_STATUS_LITE_NOT_FIND_OP = OH_AI_COMPCODE_LITE | (0x0FFFFFFF & -300),     /**< Failed to find operator. */
797777dab0Sopenharmony_ci  OH_AI_STATUS_LITE_INVALID_OP_NAME = OH_AI_COMPCODE_LITE | (0x0FFFFFFF & -301), /**< Invalid operator name. */
807777dab0Sopenharmony_ci  OH_AI_STATUS_LITE_INVALID_OP_ATTR = OH_AI_COMPCODE_LITE | (0x0FFFFFFF & -302), /**< Invalid operator attr. */
817777dab0Sopenharmony_ci  OH_AI_STATUS_LITE_OP_EXECUTE_FAILURE =
827777dab0Sopenharmony_ci    OH_AI_COMPCODE_LITE | (0x0FFFFFFF & -303), /**< Failed to execution operator. */
837777dab0Sopenharmony_ci
847777dab0Sopenharmony_ci  // Tensor error code, range: [-400,-500)
857777dab0Sopenharmony_ci  OH_AI_STATUS_LITE_FORMAT_ERROR = OH_AI_COMPCODE_LITE | (0x0FFFFFFF & -400), /**< Failed to checking tensor format. */
867777dab0Sopenharmony_ci
877777dab0Sopenharmony_ci  // InferShape error code, range: [-500,-600)
887777dab0Sopenharmony_ci  OH_AI_STATUS_LITE_INFER_ERROR = OH_AI_COMPCODE_LITE | (0x0FFFFFFF & -500), /**< Failed to infer shape. */
897777dab0Sopenharmony_ci  OH_AI_STATUS_LITE_INFER_INVALID =
907777dab0Sopenharmony_ci    OH_AI_COMPCODE_LITE | (0x0FFFFFFF & -501), /**< Invalid infer shape before runtime. */
917777dab0Sopenharmony_ci
927777dab0Sopenharmony_ci  // User input param error code, range: [-600, 700)
937777dab0Sopenharmony_ci  OH_AI_STATUS_LITE_INPUT_PARAM_INVALID =
947777dab0Sopenharmony_ci    OH_AI_COMPCODE_LITE | (0x0FFFFFFF & -600), /**< Invalid input param by user. */
957777dab0Sopenharmony_ci} OH_AI_Status;
967777dab0Sopenharmony_ci#ifdef __cplusplus
977777dab0Sopenharmony_ci}
987777dab0Sopenharmony_ci#endif
997777dab0Sopenharmony_ci#endif  // MINDSPORE_INCLUDE_C_API_STATUS_C_H
100