def train_read
bendtorch-load@1.3.0.0 · main.bend:188
import bendtorch-load@1.3.0.0/main.bend as BendtorchLoad
import Base
import bendtorch@1.3.0.0/main.bend as T
188
189
190
191def train_read(~P: Type, ~X: Type, ~Y: Type, ~S: Type, ~m: T.Layer<P, X, Y, S>, +path: String, +base: U32, +copies: U32, +tail: U32, tr: T.Train<P>) -> IO(T.Train<P>):
192 do IO<T.Train<P>>:
193 require(U32.is_le(base, U32.div(U32.sub(4294967295, tail), copies)), "checkpoint exceeds 2^32 - 1 numbers")
194 +n : U32 = ((copies * base : U32) + tail : U32)
195 a : Array<F32> <- read(path, n)
196 return T.Train.restore(~P, ~X, ~Y, ~S, ~m, tr, a)