Module Shape.Checkpoint

Checkpoints (gh-ocannl-903)

The shape-inference half of Tensor.checkpoint: use that. A checkpoint snapshots the open frontier -- this module's and Row's module-level session state (persistent values, captured as pointers), and the mutable fields of the shapes and steps of the active update steps and of every live capture reference -- and a rewind puts them back and discards what the window created.

type t
val label : t -> Base.string
val is_closure : t -> Base.bool
val refusal : t -> Base.string Base.option

Why the checkpoint can no longer be rewound to: a closure since it was taken, a rewind past it (or to the last closure, or a reset), a raising committed-state read of a shape open at the checkpoint, or a shape older than it outside its frontier. None when it can be. Checked before a rewind writes anything.

val categories : Base.string Base.list

The restore categories rewind can be told to omit: negative controls only.

val rewind : ?omit:Base.string -> t -> provenance:Base.string -> Base.unit

Discards the window's shapes, update steps and the capture references it made and touched (with provenance); restores the frontier's objects and the module-level state; clears the taint. The caller checks refusal first.

val differences : t -> Base.string Base.list

The components of the session that differ from the checkpoint, by name: a diagnostic.

val sizes : t -> (Base.string * Base.int) Base.list

The open frontier's sizes at the checkpoint: a diagnostic.