未验证 提交 fa449c88 编写于 作者: T tianshuo78520a 提交者: GitHub

fix typo word (#22761)

上级 66991218
...@@ -458,7 +458,7 @@ def name_scope(prefix=None): ...@@ -458,7 +458,7 @@ def name_scope(prefix=None):
if in_dygraph_mode(): if in_dygraph_mode():
yield yield
else: else:
assert prefix, "namescope prefix canot be empty." assert prefix, "namescope prefix can not be empty."
global _name_scope global _name_scope
_name_scope = _name_scope.child(prefix) _name_scope = _name_scope.child(prefix)
yield yield
...@@ -1495,7 +1495,7 @@ class Variable(object): ...@@ -1495,7 +1495,7 @@ class Variable(object):
if length < 0: if length < 0:
raise ValueError("length should not be negative") raise ValueError("length should not be negative")
if step == 0: if step == 0:
raise ValueError("slice step canot be zero") raise ValueError("slice step can not be zero")
# Find lower and upper bounds for start and stop. # Find lower and upper bounds for start and stop.
lower = -1 if step < 0 else 0 lower = -1 if step < 0 else 0
...@@ -2965,7 +2965,7 @@ class IrVarNode(IrNode): ...@@ -2965,7 +2965,7 @@ class IrVarNode(IrNode):
shape(list): shape to be set. shape(list): shape to be set.
""" """
assert self.node.var() is not None, \ assert self.node.var() is not None, \
"The node variable description canot be None." "The node variable description can not be None."
self.node.var().set_shape(shape) self.node.var().set_shape(shape)
def persistable(self): def persistable(self):
...@@ -2976,7 +2976,7 @@ class IrVarNode(IrNode): ...@@ -2976,7 +2976,7 @@ class IrVarNode(IrNode):
bool: indicate whether the variable is persistable. bool: indicate whether the variable is persistable.
""" """
assert self.node.var() is not None, \ assert self.node.var() is not None, \
"The node variable description canot be None." "The node variable description can not be None."
return self.node.var().persistable() return self.node.var().persistable()
def type(self): def type(self):
...@@ -2987,7 +2987,7 @@ class IrVarNode(IrNode): ...@@ -2987,7 +2987,7 @@ class IrVarNode(IrNode):
core.VarDesc.VarType: the variable type. core.VarDesc.VarType: the variable type.
""" """
assert self.node.var() is not None, \ assert self.node.var() is not None, \
"The node variable description canot be None." "The node variable description can not be None."
return self.node.var().type() return self.node.var().type()
def dtype(self): def dtype(self):
...@@ -2998,7 +2998,7 @@ class IrVarNode(IrNode): ...@@ -2998,7 +2998,7 @@ class IrVarNode(IrNode):
core.VarDesc.VarType: the variable data type. core.VarDesc.VarType: the variable data type.
""" """
assert self.node.var() is not None, \ assert self.node.var() is not None, \
"The node variable description canot be None." "The node variable description can not be None."
return self.node.var().dtype() return self.node.var().dtype()
def shape(self): def shape(self):
...@@ -3009,7 +3009,7 @@ class IrVarNode(IrNode): ...@@ -3009,7 +3009,7 @@ class IrVarNode(IrNode):
list: the variable shape. list: the variable shape.
""" """
assert self.node.var() is not None, \ assert self.node.var() is not None, \
"The node variable description canot be None." "The node variable description can not be None."
return self.node.var().shape() return self.node.var().shape()
@property @property
...@@ -3059,7 +3059,7 @@ class IrOpNode(IrNode): ...@@ -3059,7 +3059,7 @@ class IrOpNode(IrNode):
new_input_name(str): the new input name. new_input_name(str): the new input name.
""" """
assert self.node.op() is not None, \ assert self.node.op() is not None, \
"The node operator description canot be None." "The node operator description can not be None."
self.node.op()._rename_input(old_input_name, new_input_name) self.node.op()._rename_input(old_input_name, new_input_name)
def rename_output(self, old_output_name, new_output_name): def rename_output(self, old_output_name, new_output_name):
...@@ -3071,7 +3071,7 @@ class IrOpNode(IrNode): ...@@ -3071,7 +3071,7 @@ class IrOpNode(IrNode):
new_output_name(str): the new output name. new_output_name(str): the new output name.
""" """
assert self.node.op() is not None, \ assert self.node.op() is not None, \
"The node operator description canot be None." "The node operator description can not be None."
print("op: {}, old: {}, new: {}\n".format(self.node.op().type( print("op: {}, old: {}, new: {}\n".format(self.node.op().type(
), old_output_name, new_output_name)) ), old_output_name, new_output_name))
self.node.op()._rename_output(old_output_name, new_output_name) self.node.op()._rename_output(old_output_name, new_output_name)
...@@ -3087,7 +3087,7 @@ class IrOpNode(IrNode): ...@@ -3087,7 +3087,7 @@ class IrOpNode(IrNode):
list(str): the argument name list. list(str): the argument name list.
""" """
assert self.node.op() is not None, \ assert self.node.op() is not None, \
"The node operator description canot be None." "The node operator description can not be None."
return self.node.op().input(name) return self.node.op().input(name)
def output(self, name): def output(self, name):
...@@ -3101,7 +3101,7 @@ class IrOpNode(IrNode): ...@@ -3101,7 +3101,7 @@ class IrOpNode(IrNode):
list(str): the argument name list. list(str): the argument name list.
""" """
assert self.node.op() is not None, \ assert self.node.op() is not None, \
"The node operator description canot be None." "The node operator description can not be None."
return self.node.op().output(name) return self.node.op().output(name)
def set_type(self, new_type): def set_type(self, new_type):
...@@ -3112,7 +3112,7 @@ class IrOpNode(IrNode): ...@@ -3112,7 +3112,7 @@ class IrOpNode(IrNode):
new_type(str): new operator type to be set. new_type(str): new operator type to be set.
""" """
assert self.node.op() is not None, \ assert self.node.op() is not None, \
"The node operator description canot be None." "The node operator description can not be None."
return self.node.op().set_type(new_type) return self.node.op().set_type(new_type)
def set_attr(self, name, val): def set_attr(self, name, val):
...@@ -3130,7 +3130,7 @@ class IrOpNode(IrNode): ...@@ -3130,7 +3130,7 @@ class IrOpNode(IrNode):
Update the value of the op desc's attribute by attribute's name. Update the value of the op desc's attribute by attribute's name.
""" """
assert self.node.op() is not None, \ assert self.node.op() is not None, \
"The node operator description canot be None." "The node operator description can not be None."
desc = self.node.op() desc = self.node.op()
if isinstance(val, Block): if isinstance(val, Block):
desc.set_block_attr(name, val.desc) desc.set_block_attr(name, val.desc)
...@@ -3151,7 +3151,7 @@ class IrOpNode(IrNode): ...@@ -3151,7 +3151,7 @@ class IrOpNode(IrNode):
list(str): input arguments' names of this op node. list(str): input arguments' names of this op node.
""" """
assert self.node.op() is not None, \ assert self.node.op() is not None, \
"The node operator description canot be None." "The node operator description can not be None."
return self.node.op().input_arg_names() return self.node.op().input_arg_names()
def output_arg_names(self): def output_arg_names(self):
...@@ -3162,7 +3162,7 @@ class IrOpNode(IrNode): ...@@ -3162,7 +3162,7 @@ class IrOpNode(IrNode):
list(str): output arguments' names of this op node. list(str): output arguments' names of this op node.
""" """
assert self.node.op() is not None, \ assert self.node.op() is not None, \
"The node operator description canot be None." "The node operator description can not be None."
return self.node.op().output_arg_names() return self.node.op().output_arg_names()
@property @property
...@@ -3459,7 +3459,7 @@ class IrGraph(object): ...@@ -3459,7 +3459,7 @@ class IrGraph(object):
""" """
Perform the topology sort operation on the graph. Perform the topology sort operation on the graph.
Notes: the `graph` canot contain a circle. Notes: the `graph` can not contain a circle.
Returns: Returns:
list(IrNode): nodes in topology order. list(IrNode): nodes in topology order.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册