From 2d47634b9ab3d17a66f75fc855b574a029389f4a Mon Sep 17 00:00:00 2001 From: jiangchangting1 Date: Thu, 10 Aug 2023 12:27:15 +0000 Subject: [PATCH 1/4] update debug/accuracy_tools/api_accuracy_checker/run_ut/run_ut.py. Signed-off-by: jiangchangting1 --- debug/accuracy_tools/api_accuracy_checker/run_ut/run_ut.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/debug/accuracy_tools/api_accuracy_checker/run_ut/run_ut.py b/debug/accuracy_tools/api_accuracy_checker/run_ut/run_ut.py index 52d5d928d0..69f0031f9f 100644 --- a/debug/accuracy_tools/api_accuracy_checker/run_ut/run_ut.py +++ b/debug/accuracy_tools/api_accuracy_checker/run_ut/run_ut.py @@ -71,10 +71,13 @@ def run_ut(forward_file, backward_file, out_path, save_error_data): api_info_dict) compare.compare_output(api_full_name, out, npu_out, grad_out, npu_grad_out) except Exception as err: + [_, api_name, _] = api_full_name.split("*") if "not implemented for 'Half'" in str(err): - [_, api_name, _] = api_full_name.split("*") print_warn_log(f"API {api_name} not support half tensor in CPU, please add {api_name} to CONVERT_API " f"'fp16_to_fp32' list in accuracy_tools/api_accuracy_check/common/utils.py file.") + elif "expected scalar type Long" in str(err): + print_warn_log(f"API {api_name} not support half tensor in CPU, please add {api_name} to CONVERT_API " + f"'int32_to_int64' list in accuracy_tools/api_accuracy_check/common/utils.py file.") else: print_error_log(f"Run {api_full_name} UT Error: %s" % str(err)) -- Gitee From e40d888421812b7859130b8c748a288bb31857ae Mon Sep 17 00:00:00 2001 From: jiangchangting1 Date: Thu, 10 Aug 2023 12:28:03 +0000 Subject: [PATCH 2/4] update debug/accuracy_tools/api_accuracy_checker/common/utils.py. Signed-off-by: jiangchangting1 --- debug/accuracy_tools/api_accuracy_checker/common/utils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/debug/accuracy_tools/api_accuracy_checker/common/utils.py b/debug/accuracy_tools/api_accuracy_checker/common/utils.py index f1c874407f..fc30511398 100644 --- a/debug/accuracy_tools/api_accuracy_checker/common/utils.py +++ b/debug/accuracy_tools/api_accuracy_checker/common/utils.py @@ -81,11 +81,13 @@ class Const: WRITE_MODES = stat.S_IWUSR | stat.S_IRUSR CONVERT = { - "fp16_to_fp32": ["torch.float16", "torch.float32"] + "fp16_to_fp32": ["torch.float16", "torch.float32"], + "int32_to_int64": ["torch.int32", "torch.int64"] } CONVERT_API = { - "fp16_to_fp32": ["conv2d", "batch_norm", "relu", "max_pool2d", "interpolate", "group_norm", "layer_norm", "bmm", "tanh", "cross_entropy", "linear", "numel"] + "fp16_to_fp32": ["conv2d", "batch_norm", "relu", "max_pool2d", "interpolate", "group_norm", "layer_norm", "bmm", "tanh", "cross_entropy"], + "int32_to_int64": ["cross_entropy"] } class CompareConst: -- Gitee From ef09828c923ac11d0588d9572634d5cde1b9beec Mon Sep 17 00:00:00 2001 From: jiangchangting1 Date: Thu, 10 Aug 2023 12:59:21 +0000 Subject: [PATCH 3/4] update debug/accuracy_tools/api_accuracy_checker/common/utils.py. Signed-off-by: jiangchangting1 --- debug/accuracy_tools/api_accuracy_checker/common/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debug/accuracy_tools/api_accuracy_checker/common/utils.py b/debug/accuracy_tools/api_accuracy_checker/common/utils.py index fc30511398..4ee04396ba 100644 --- a/debug/accuracy_tools/api_accuracy_checker/common/utils.py +++ b/debug/accuracy_tools/api_accuracy_checker/common/utils.py @@ -86,7 +86,7 @@ class Const: } CONVERT_API = { - "fp16_to_fp32": ["conv2d", "batch_norm", "relu", "max_pool2d", "interpolate", "group_norm", "layer_norm", "bmm", "tanh", "cross_entropy"], + "fp16_to_fp32": ["conv2d", "batch_norm", "relu", "max_pool2d", "interpolate", "group_norm", "layer_norm", "bmm", "tanh", "cross_entropy", "linear", "numel"], "int32_to_int64": ["cross_entropy"] } -- Gitee From fe4666434ca92315ab00996ba33dd18eaee382de Mon Sep 17 00:00:00 2001 From: jiangchangting1 Date: Fri, 11 Aug 2023 02:43:07 +0000 Subject: [PATCH 4/4] update debug/accuracy_tools/api_accuracy_checker/run_ut/run_ut.py. Signed-off-by: jiangchangting1 --- debug/accuracy_tools/api_accuracy_checker/run_ut/run_ut.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debug/accuracy_tools/api_accuracy_checker/run_ut/run_ut.py b/debug/accuracy_tools/api_accuracy_checker/run_ut/run_ut.py index 69f0031f9f..e52d447a91 100644 --- a/debug/accuracy_tools/api_accuracy_checker/run_ut/run_ut.py +++ b/debug/accuracy_tools/api_accuracy_checker/run_ut/run_ut.py @@ -76,7 +76,7 @@ def run_ut(forward_file, backward_file, out_path, save_error_data): print_warn_log(f"API {api_name} not support half tensor in CPU, please add {api_name} to CONVERT_API " f"'fp16_to_fp32' list in accuracy_tools/api_accuracy_check/common/utils.py file.") elif "expected scalar type Long" in str(err): - print_warn_log(f"API {api_name} not support half tensor in CPU, please add {api_name} to CONVERT_API " + print_warn_log(f"API {api_name} not support int32 tensor in CPU, please add {api_name} to CONVERT_API " f"'int32_to_int64' list in accuracy_tools/api_accuracy_check/common/utils.py file.") else: print_error_log(f"Run {api_full_name} UT Error: %s" % str(err)) -- Gitee