Skip to main content

core.run

core.run(fit, data, /, *, generator=None)

Run every pass of fit over data, under no_grad.

Its statistic goes through all_reduce before finish. This is the loop the front doors run. Under no_grad the result carries no graph; for gradients through the fit, write the loop by hand.

Parameters

Name Type Description Default
fit CurvatureFit[Any, Any] | StagedCurvatureFit[Any] The bound fit, from fit_curvature. required
data Callable[[torch.Generator], Iterable[Batch]] Batches per pass: pass \(i\) reads the batches of data(g), with g a fresh CPU generator for that pass. required
generator torch.Generator | None Seeds the data passes. One seed is drawn from it, or from torch’s global RNG when None, and each pass’s generator is derived from that seed and the pass number. The fit’s own draws come from the seed fit_curvature drew. None

Returns

Name Type Description
Finished[Any] The finished fit.

Raises

Name Type Description
CapabilityError A pass or batch fails the method’s requirements, including a curvature that needs targets the batch lacks.
StructureError The method refuses the params or layout, the likelihood’s check_targets finds badly shaped targets, or a LateLikelihood has an active mask, which fit_stat can’t apply.
ValueError The likelihood’s check_targets finds a bad target value, or a curvature refuses its settings or its statistic (e.g. a zero total weight).