def Train.restore

bendtorch@1.3.0.0 · main.bend:3576

import bendtorch@1.3.0.0/main.bend as Bendtorch
import Base

3576# a training state filled from the numbers Train.dump wrote (its buffers are overwritten in place; packed moments are
3577# built again from the tree's cells)
3578def Train.restore(~P: Type, ~X: Type, ~Y: Type, ~S: Type, ~m: Layer<P, X, Y, S>, tr: Train<P>, xs: Array<F32>) -> Train<P>:
3579  match tr:
3580    case Train{p, g, NoMom{}, p1, p2, l}:
3581      tr0(P, g, Layer.load(P, X, Y, S, m, p, xs, 0))
3582    case Train{p, g, OneMom{mm}, p1, p2, l}:
3583      tr_m1(~P, ~X, ~Y, ~S, ~m, mm, g, Layer.load(P, X, Y, S, m, p, xs, 0))
3584    case Train{p, g, TwoMom{mm, vv}, p1, p2, l}:
3585      tr1(~P, ~X, ~Y, ~S, ~m, mm, vv, g, Layer.load(P, X, Y, S, m, p, xs, 0))
3586    case Train{p, g, Packed{t}, p1, p2, l}:
3587      trp(P, g, Layer.load(P, X, Y, S, m, p, xs, 0))

Uses (10)

Used by (1)