From ff57caceb98c1261642c7f48a60a3116435f3c8d Mon Sep 17 00:00:00 2001 From: zhaojichen Date: Thu, 23 Apr 2020 04:31:14 -0400 Subject: [PATCH] change error type --- mindspore/_checkparam.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mindspore/_checkparam.py b/mindspore/_checkparam.py index dba1c13b3..9ecf0c9e2 100644 --- a/mindspore/_checkparam.py +++ b/mindspore/_checkparam.py @@ -305,9 +305,9 @@ class Validator: msg_prefix = f'For \'{prim_name}\' the' if prim_name else 'The' if len(valid_types) == 1: raise TypeError(f'{msg_prefix} type of `{arg_name}` should be {type_names[0]},' - f' but got {get_typename(arg_type)}.') + f' but got {get_typename(arg_type)}.') raise TypeError(f'{msg_prefix} type of `{arg_name}` should be one of {type_names},' - f' but got {get_typename(arg_type)}.') + f' but got {get_typename(arg_type)}.') @staticmethod def check_float_legal_value(arg_name, arg_value, prim_name): @@ -418,7 +418,7 @@ class ParamValidator: type_names = [t.__name__ for t in valid_types] num_types = len(valid_types) raise TypeError(f'The type of `{arg_name}` should be {"one of " if num_types > 1 else ""}' - f'{type_names if num_types > 1 else type_names[0]}, but got {type(arg_value).__name__}.') + f'{type_names if num_types > 1 else type_names[0]}, but got {type(arg_value).__name__}.') if isinstance(arg_value, type(mstype.tensor)): arg_value = arg_value.element_type() -- GitLab