Module Optimise.Checkpoint

Checkpoint module

type state = {
  1. mutable current_batch : int;
  2. mutable batches_per_epoch : int;
  3. mutable epochs : float;
  4. mutable batches : int;
  5. mutable loss : Algodiff.t array;
  6. mutable start_at : float;
  7. mutable stop : bool;
  8. mutable gs : Algodiff.t array array;
  9. mutable ps : Algodiff.t array array;
  10. mutable us : Algodiff.t array array;
  11. mutable ch : Algodiff.t array array array;
}

Type definition of checkpoint

type typ =
  1. | Batch of int
  2. | Epoch of float
  3. | Custom of state -> unit
  4. | None

Batch type.

val init_state : int -> float -> state

init_state batches_per_epoch epochs initialises a state by specifying the number of batches per epoch and the number of epochs in total.

val default_checkpoint_fun : (string -> 'a) -> 'a

This function is used for saving intermediate files during optimisation.

val print_state_info : state -> unit

Print out the detail information of current state.

val print_summary : state -> unit

Print out the summary of current state.

val run : typ -> (string -> unit) -> int -> Algodiff.t -> state -> unit

Execute the computations defined in module typ.

val to_string : typ -> string

Convert the module typ to its string representation.