Skip to content

Commit

Permalink
Prevent Nones from causing errors during profiling
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonwillard committed Mar 13, 2022
1 parent e69b52d commit 028787a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions aesara/graph/opt.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,10 @@ def print_profile(stream, prof, level=0):
nb_nodes,
callbacks_time,
) = prof

validate_time = validate_time or float("nan")
callback_time = callback_time or float("nan")

blanc = " " * level

print(blanc, "SeqOptimizer", end=" ", file=stream)
Expand Down Expand Up @@ -805,6 +809,9 @@ def print_profile(stream, prof, level=0):
nb_atomic,
) = prof

validate_time = validate_time or float("nan")
callback_time = callback_time or float("nan")

blanc = " " * level
print(blanc, "MergeOptimizer", file=stream)
print(
Expand Down
2 changes: 1 addition & 1 deletion aesara/tensor/basic_opt.py
Original file line number Diff line number Diff line change
Expand Up @@ -3350,7 +3350,7 @@ def print_profile(stream, prof, level=0):
print(blanc, " nb_inconsistency_replace", prof[3], file=stream)
print(blanc, " validate_time", prof[4], file=stream)
print(blanc, " callback_time", prof[5], file=stream)
if prof[5] > 1:
if prof[5] is not None and prof[5] > 1:
print(blanc, " callbacks_time", file=stream)
for i in sorted(prof[6].items(), key=lambda a: a[1])[::-1]:
if i[1] > 0:
Expand Down

0 comments on commit 028787a

Please sign in to comment.