forked from mindspore-Ecosystem/mindspore
Modify error info
This commit is contained in:
parent
b14a9ee74b
commit
47a52a4d02
|
@ -244,8 +244,8 @@ class Cell(Cell_):
|
|||
@parameter_layout_dict.setter
|
||||
def parameter_layout_dict(self, value):
|
||||
if not isinstance(value, dict):
|
||||
raise TypeError("The type of parameter 'value' must be a dict type, "
|
||||
"but got the type : {}.".format(type(value)))
|
||||
raise TypeError(f"For 'Cell', the property 'parameter_layout_dict' must be dict type, "
|
||||
f"but got type {type(value)}.")
|
||||
self._parameter_layout_dict = value
|
||||
|
||||
@property
|
||||
|
@ -255,8 +255,8 @@ class Cell(Cell_):
|
|||
@parallel_parameter_name_list.setter
|
||||
def parallel_parameter_name_list(self, value):
|
||||
if not isinstance(value, list):
|
||||
raise TypeError("The type of parameter 'parallel_parameter_name_list' must be a list type, "
|
||||
"but got the type : {}.".format(type(value)))
|
||||
raise TypeError(f"For 'Cell', the property 'parallel_parameter_name_list' must be list type, "
|
||||
f"but got type {type(value)}.")
|
||||
self._parallel_parameter_name_list = value
|
||||
|
||||
@property
|
||||
|
@ -265,13 +265,13 @@ class Cell(Cell_):
|
|||
|
||||
@pipeline_stage.setter
|
||||
def pipeline_stage(self, value):
|
||||
if not isinstance(value, int) or isinstance(value, bool):
|
||||
raise TypeError("The parameter 'pipeline_stage' must be an int type, "
|
||||
"but got the type : {}.".format(type(value)))
|
||||
if not isinstance(value, int):
|
||||
raise TypeError(f"For 'Cell', the property 'pipeline_stage' must be int type, "
|
||||
f"but got type {type(value)}.")
|
||||
|
||||
if value < 0:
|
||||
raise TypeError("The parameter 'pipeline_stage' can not be less than 0, "
|
||||
"but got the value : {}".format(value))
|
||||
raise TypeError("For 'Cell', the property 'pipeline_stage' can not be less than 0, "
|
||||
"but got {}".format(value))
|
||||
self._pipeline_stage = value
|
||||
for item in self.trainable_params():
|
||||
item.add_pipeline_stage(value)
|
||||
|
@ -283,8 +283,8 @@ class Cell(Cell_):
|
|||
@parallel_parameter_merge_net_dict.setter
|
||||
def parallel_parameter_merge_net_dict(self, value):
|
||||
if not isinstance(value, dict):
|
||||
raise TypeError("The parameter 'parallel_parameter_merge_net_dict' must be a dict type, "
|
||||
"but got the type : {}".format(type(value)))
|
||||
raise TypeError(f"For 'Cell', the property 'parallel_parameter_merge_net_dict' must be dict type, "
|
||||
f"but got type {type(value)}.")
|
||||
self._parallel_parameter_merge_net_dict = value
|
||||
|
||||
def get_func_graph_proto(self):
|
||||
|
|
|
@ -398,7 +398,7 @@ class Optimizer(Cell):
|
|||
raise ValueError(f"For 'Optimizer', the dim of Tensor type 'learning_rate' should be a 0 or 1, "
|
||||
f"but got {learning_rate.ndim}.")
|
||||
if learning_rate.ndim == 1 and learning_rate.size < 2:
|
||||
logger.warning("If use `Tensor` type dynamic learning rate, please make sure that the number"
|
||||
logger.warning("If use `Tensor` type dynamic learning rate, please make sure that the number "
|
||||
"of elements in the tensor is greater than 1.")
|
||||
return learning_rate
|
||||
if isinstance(learning_rate, LearningRateSchedule):
|
||||
|
|
Loading…
Reference in New Issue