File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change 35
35
# 5. Using tracing functionality
36
36
# 6. Examining stack traces
37
37
# 7. Using profiler to analyze long-running jobs
38
+ # 8. Memory Timeline Visualization
38
39
#
39
40
# 1. Import all necessary libraries
40
41
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -453,6 +454,16 @@ def trace_handler(p):
453
454
model (inputs )
454
455
p .step ()
455
456
457
+ ######################################################################
458
+ # Memory Timeline Visualization
459
+ with profile (activities = [ProfilerActivity .CPU ],
460
+ profile_memory = True , record_shapes = True , with_stack = True ) as prof :
461
+ model (inputs )
462
+
463
+ # Add the memory timeline export right after:
464
+ prof .export_memory_timeline ("memory_timeline.html" )
465
+
466
+
456
467
######################################################################
457
468
# Learn More
458
469
# ----------
You can’t perform that action at this time.
0 commit comments