def Train.save
import bendtorch@1.3.0.0/main.bend as Bendtorchimport Base
3697# the layout Train.dump gives, written from one array instead of a list (the same bytes)
3698def Train.save(~P: Type, ~X: Type, ~Y: Type, ~S: Type, ~m: Layer<P, X, Y, S>, +path: String, tr: Train<P>) -> IO(Train<P>):
3699 match tr:
3700 case Train{p, g, NoMom{}, +p1, +p2, +l}:
3701 tsa_fin(P, path, g, NoMom{}, p1, p2, l, Layer.store(P, X, Y, S, m, p, Array.new(F32, depth(U32.to_nat(Layer.count(P, X, Y, S, m))), 0.0), 0))
3702 case Train{p, g, OneMom{mm}, +p1, +p2, +l}:
3703 tsa_mm(~P, ~X, ~Y, ~S, ~m, path, mm, g, p1, p2, l, Layer.store(P, X, Y, S, m, p, Array.new(F32, depth(U32.to_nat((2 * Layer.count(P, X, Y, S, m) : U32))), 0.0), 0))
3704 case Train{p, g, TwoMom{mm, vv}, +p1, +p2, +l}:
3705 tsa_mv(~P, ~X, ~Y, ~S, ~m, path, mm, vv, g, p1, p2, l, Layer.store(P, X, Y, S, m, p, Array.new(F32, depth(U32.to_nat(((3 * Layer.count(P, X, Y, S, m) : U32) + 2 : U32))), 0.0), 0))
3706 case Train{p, g, Packed{t}, +p1, +p2, +l}:
3707 tsp(~P, ~X, ~Y, ~S, ~m, path, p, g, p1, p2, l, pt_cells(t))
Uses (19)
Used by (0)
No other definition uses this definition.