core.resolve_strategy
core.resolve_strategy(caps, event_size, n_params, /, *, n_samples=None)The pushforward mode strategy=None picks, for \(E\) output entries and \(P\) parameters.
With n_samples=None (chosen): when both exact paths fit (exact_fits), forward mode if \(P < E\) (a factor of \(P\) columns instead of [E, E] blocks), else reverse mode; when one fits, that one. When neither does (sampled outputs), reverse mode (a VJP of a VJP) when the probe found vjp_twice, else forward mode when it found jvp. event_size=None picks reverse mode when both fit.
The VJP of a VJP records the forward once, and its graph and the backward’s stay in memory until the last draw. strategy="forward-mode" runs the forward per draw instead.
n_samples="exact" ignores the budgets: it picks among the exact paths the capabilities allow, with the same \(P < E\) rule when both are possible. When neither is, the requirement check that follows refuses the result.
An int n_samples (sampled outputs) picks as sampled outputs do.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| caps | Capabilities | The model’s capabilities. | required |
| event_size | int | None | Output entries per input \(E\), or None when not known yet. |
required |
| n_params | int | The number of parameters \(P\). | required |
| n_samples | int | Literal['exact'] | None | n_samples of predict_outputs. |
None |
Returns
| Name | Type | Description |
|---|---|---|
| Strategy | "forward-mode" or "reverse-mode". |