Snapshot of allocator state at a single point in time.
Wraps the engine's memory tracker so user code can correlate peak
memory usage with specific phases of training or inference. Combined
with Profiler events, this is sufficient to diagnose memory
regressions and validate the effect of activation checkpointing.
Parameters
implobjectUnderlying engine
MemoryStats handle.Notes
Reported quantities are byte counts. The ratio is a coarse indicator of fragmentation overhead.
Examples
>>> import lucid
>>> with lucid.profiler.profile() as prof:
... _ = lucid.randn(1024, 1024)
>>> stats = prof.memory_stats()
>>> stats and stats.peak_bytes