提交 37d4c401 authored 作者: Ricardo Vieira's avatar Ricardo Vieira 提交者: Ricardo Vieira

Replace not x.owner by x.owner is None

上级 be0e13a9
...@@ -173,7 +173,7 @@ def _unify_Variable_Variable(u, v, s): ...@@ -173,7 +173,7 @@ def _unify_Variable_Variable(u, v, s):
yield s yield s
return return
if not u.owner and not v.owner: if u.owner is None and v.owner is None:
yield False yield False
return return
...@@ -201,7 +201,7 @@ _unify.add((Constant, Constant, Mapping), _unify_Constant_Constant) ...@@ -201,7 +201,7 @@ _unify.add((Constant, Constant, Mapping), _unify_Constant_Constant)
def _unify_Variable_ExpressionTuple(u, v, s): def _unify_Variable_ExpressionTuple(u, v, s):
# `Constant`s are "atomic" # `Constant`s are "atomic"
if not u.owner: if u.owner is None:
yield False yield False
return return
......
...@@ -445,7 +445,7 @@ def raise_with_op( ...@@ -445,7 +445,7 @@ def raise_with_op(
sz = np.dtype(dtype).itemsize * np.prod(shapeinfo) sz = np.dtype(dtype).itemsize * np.prod(shapeinfo)
storage_map_item.append(sz) storage_map_item.append(sz)
total_size += sz total_size += sz
if not k.owner: if k.owner is None:
total_size_inputs += sz total_size_inputs += sz
else: else:
# If it is a view, don't count it twice. # If it is a view, don't count it twice.
......
...@@ -1339,7 +1339,7 @@ def pydotprint( ...@@ -1339,7 +1339,7 @@ def pydotprint(
if cond_highlight is not None: if cond_highlight is not None:
def recursive_pass(x, ls): def recursive_pass(x, ls):
if not x.owner: if x.owner is None:
return ls return ls
else: else:
ls += [x.owner] ls += [x.owner]
......
...@@ -396,7 +396,7 @@ def local_subtensor_lift(fgraph, node): ...@@ -396,7 +396,7 @@ def local_subtensor_lift(fgraph, node):
""" """
if isinstance(node.op, Subtensor): if isinstance(node.op, Subtensor):
u = node.inputs[0] u = node.inputs[0]
if not u.owner or len(fgraph.clients[u]) > 1: if u.owner is None or len(fgraph.clients[u]) > 1:
return False return False
if isinstance(u.owner.op, Elemwise) and len(u.owner.inputs) == 1: if isinstance(u.owner.op, Elemwise) and len(u.owner.inputs) == 1:
......
...@@ -1400,7 +1400,7 @@ def inc_subtensor( ...@@ -1400,7 +1400,7 @@ def inc_subtensor(
# We insert a SpecifyShape Op to make sure it is the case. # We insert a SpecifyShape Op to make sure it is the case.
y = specify_broadcastable(y, dim) y = specify_broadcastable(y, dim)
if not x.owner: if x.owner is None:
raise TypeError("x must be the result of a subtensor operation") raise TypeError("x must be the result of a subtensor operation")
# retrieve idx_list from x.owner # retrieve idx_list from x.owner
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论