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