You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

errorcode.h 3.0 kB

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