Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions pytensor/compile/profiling.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
else:
destination_file = config.profiling__destination

with extended_open(destination_file, mode="w"):
with extended_open(destination_file, mode="w") as f:
# Reverse sort in the order of compile+exec time
for ps in sorted(
_atexit_print_list, key=lambda a: a.compile_time + a.fct_call_time
Expand All @@ -73,7 +73,7 @@
or getattr(ps, "callcount", 0) > 1
):
ps.summary(
file=destination_file,
file=f,
n_ops_to_print=config.profiling__n_ops,
n_apply_to_print=config.profiling__n_apply,
)
Expand Down Expand Up @@ -131,7 +131,7 @@
cum.rewriter_profile = None

cum.summary(
file=destination_file,
file=f,
n_ops_to_print=config.profiling__n_ops,
n_apply_to_print=config.profiling__n_apply,
)
Expand All @@ -157,7 +157,7 @@
else:
destination_file = config.profiling__destination

with extended_open(destination_file, mode="w"):
with extended_open(destination_file, mode="w") as f:
print("=" * 50, file=destination_file)
print(
(
Expand All @@ -167,9 +167,9 @@
"Time spent compiling PyTensor functions: "
f"rewriting = {total_graph_rewrite_time:6.3f}s, linking = {total_time_linker:6.3f}s ",
),
file=destination_file,
file=f,
)
print("=" * 50, file=destination_file)
print("=" * 50, file=f)

Check warning on line 172 in pytensor/compile/profiling.py

View check run for this annotation

Codecov / codecov/patch

pytensor/compile/profiling.py#L172

Added line #L172 was not covered by tests


_profiler_printers = []
Expand Down
Loading