CUDA Graphs¶
CUDA-graphed wrapper for stateful models.
GraphedStatefulModel ¶
Bases: Module
Wraps a stateful model with CUDA-graphed forward, same interface.
The model must return (output, state) from forward().
The CUDA graph is captured lazily on the first forward call.
When input shapes change (e.g. different batch size at test time),
falls back to eager execution automatically.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
Module
|
stateful model returning |
required |
num_warmup_iters
|
int
|
warmup iterations before graph capture |
11
|