Skip to content

Commit 37d4c40

Browse files
committed
Replace not x.owner by x.owner is None
1 parent be0e13a commit 37d4c40

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

pytensor/graph/rewriting/unify.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ def _unify_Variable_Variable(u, v, s):
173173
yield s
174174
return
175175

176-
if not u.owner and not v.owner:
176+
if u.owner is None and v.owner is None:
177177
yield False
178178
return
179179

@@ -201,7 +201,7 @@ def _unify_Constant_Constant(u, v, s):
201201

202202
def _unify_Variable_ExpressionTuple(u, v, s):
203203
# `Constant`s are "atomic"
204-
if not u.owner:
204+
if u.owner is None:
205205
yield False
206206
return
207207

pytensor/link/utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ def raise_with_op(
445445
sz = np.dtype(dtype).itemsize * np.prod(shapeinfo)
446446
storage_map_item.append(sz)
447447
total_size += sz
448-
if not k.owner:
448+
if k.owner is None:
449449
total_size_inputs += sz
450450
else:
451451
# If it is a view, don't count it twice.

pytensor/printing.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1339,7 +1339,7 @@ def pydotprint(
13391339
if cond_highlight is not None:
13401340

13411341
def recursive_pass(x, ls):
1342-
if not x.owner:
1342+
if x.owner is None:
13431343
return ls
13441344
else:
13451345
ls += [x.owner]

pytensor/tensor/rewriting/subtensor.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ def local_subtensor_lift(fgraph, node):
396396
"""
397397
if isinstance(node.op, Subtensor):
398398
u = node.inputs[0]
399-
if not u.owner or len(fgraph.clients[u]) > 1:
399+
if u.owner is None or len(fgraph.clients[u]) > 1:
400400
return False
401401

402402
if isinstance(u.owner.op, Elemwise) and len(u.owner.inputs) == 1:

pytensor/tensor/subtensor.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1400,7 +1400,7 @@ def inc_subtensor(
14001400
# We insert a SpecifyShape Op to make sure it is the case.
14011401
y = specify_broadcastable(y, dim)
14021402

1403-
if not x.owner:
1403+
if x.owner is None:
14041404
raise TypeError("x must be the result of a subtensor operation")
14051405

14061406
# retrieve idx_list from x.owner

0 commit comments

Comments
 (0)