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 #include "include/errorcode.h"
18 #include <map>
19 #include <string>
20
21 namespace mindspore {
22 namespace lite {
GetErrorInfo(STATUS status)23 std::string GetErrorInfo(STATUS status) {
24 std::map<int, std::string> info_map = {{RET_OK, "No error occurs."},
25 {RET_ERROR, "Common error code."},
26 {RET_NULL_PTR, "NULL pointer returned."},
27 {RET_PARAM_INVALID, "Invalid parameter."},
28 {RET_NO_CHANGE, "No change."},
29 {RET_SUCCESS_EXIT, "No error but exit."},
30 {RET_MEMORY_FAILED, "Fail to create memory."},
31 {RET_NOT_SUPPORT, "Fail to support."},
32 {RET_THREAD_POOL_ERROR, "Thread pool error."},
33 {RET_OUT_OF_TENSOR_RANGE, "Failed to check range."},
34 {RET_INPUT_TENSOR_ERROR, "Failed to check input tensor."},
35 {RET_REENTRANT_ERROR, "Exist executor running."},
36 {RET_GRAPH_FILE_ERR, "Failed to verify graph file."},
37 {RET_NOT_FIND_OP, "Failed to find operator."},
38 {RET_INVALID_OP_NAME, "Invalid operator name."},
39 {RET_INVALID_OP_ATTR, "Invalid operator attr."},
40 {RET_OP_EXECUTE_FAILURE, "Failed to execution operator."},
41 {RET_FORMAT_ERR, "Failed to checking tensor format."},
42 {RET_INFER_ERR, "Failed to infer shape."},
43 {RET_INFER_INVALID, "Invalid infer shape before runtime."},
44 {RET_INPUT_PARAM_INVALID, "Invalid input param by user."}};
45 return info_map.find(status) == info_map.end() ? "Unknown error" : info_map[status];
46 }
47 } // namespace lite
48 } // namespace mindspore
49