Guides
Memory profiling
Static parameter, activation, gradient and optimizer-state bounds.
profile_model combines FLOP/traffic estimation with parameter and activation
storage bounds. For training, it also models a parameter-sized gradient buffer
and configurable optimizer state; use optimizer_state_multiplier=2 for
Adam’s two moment buffers.
from neural_cost import profile_model
from neural_cost.adapters import TorchAdapter
profile = profile_model(
model, inputs, TorchAdapter(), training=True, optimizer_state_multiplier=2
)
print(profile.memory.training_minimum_bytes)
The minimum activation bound is the largest output tensor. The conservative bound assumes all forward outputs remain live, so real allocator telemetry is the source of truth for physical VRAM use.