未验证 提交 a253a78a 编写于 作者: L Leo Chen 提交者: GitHub

fix error message (#30020)

上级 893d37e5
...@@ -1054,8 +1054,8 @@ class Variable(object): ...@@ -1054,8 +1054,8 @@ class Variable(object):
if is_new_var: if is_new_var:
self.desc.set_type(type) self.desc.set_type(type)
elif self.desc.type() != type: elif self.desc.type() != type:
raise ValueError("Variable {0} has been created before. The " raise ValueError("Variable '{0}' has been created before. The "
"previous type is {1}; the new type is {2}. They" "previous type is {1}, the new type is {2}. They"
" are not matched".format(self.name, " are not matched".format(self.name,
self.desc.type(), type)) self.desc.type(), type))
...@@ -1067,8 +1067,8 @@ class Variable(object): ...@@ -1067,8 +1067,8 @@ class Variable(object):
shape = tuple(shape) shape = tuple(shape)
if shape != old_shape: if shape != old_shape:
raise ValueError( raise ValueError(
"Variable {0} has been created before. the previous " "Variable '{0}' has been created before. The previous "
"shape is {1}; the new shape is {2}. They are not " "shape is {1}, the new shape is {2}. They are not "
"matched.".format(self.name, old_shape, shape)) "matched.".format(self.name, old_shape, shape))
if dtype is not None: if dtype is not None:
if is_new_var: if is_new_var:
...@@ -1076,8 +1076,8 @@ class Variable(object): ...@@ -1076,8 +1076,8 @@ class Variable(object):
else: else:
old_dtype = self.dtype old_dtype = self.dtype
if dtype != old_dtype: if dtype != old_dtype:
raise ValueError("Variable {0} has been created before. " raise ValueError("Variable '{0}' has been created before. "
"The previous data type is {1}; the new " "The previous data type is {1}, the new "
"data type is {2}. They are not " "data type is {2}. They are not "
"matched.".format(self.name, old_dtype, "matched.".format(self.name, old_dtype,
dtype)) dtype))
...@@ -1087,8 +1087,8 @@ class Variable(object): ...@@ -1087,8 +1087,8 @@ class Variable(object):
self.desc.set_lod_level(lod_level) self.desc.set_lod_level(lod_level)
else: else:
if lod_level != self.lod_level: if lod_level != self.lod_level:
raise ValueError("Variable {0} has been created before. " raise ValueError("Variable '{0}' has been created before. "
"The previous lod_level is {1}; the new " "The previous lod_level is {1}, the new "
"lod_level is {2}. They are not " "lod_level is {2}. They are not "
"matched".format(self.name, self.lod_level, "matched".format(self.name, self.lod_level,
lod_level)) lod_level))
...@@ -1098,8 +1098,8 @@ class Variable(object): ...@@ -1098,8 +1098,8 @@ class Variable(object):
else: else:
if persistable != self.persistable: if persistable != self.persistable:
raise ValueError( raise ValueError(
"Variable {0} has been created before." "Variable '{0}' has been created before."
"The previous persistable is {1}; the new " "The previous persistable is {1}, the new "
"persistable is {2}. They are not matched".format( "persistable is {2}. They are not matched".format(
self.name, self.persistable, persistable)) self.name, self.persistable, persistable))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册