Bendtorch.Train.save: def of bendtorch@1.3.0.0 Import: import bendtorch@1.3.0.0/main.bend as Bendtorch Lines 3697-3707 of bendtorch@1.3.0.0/main.bend: https://jend.leeeet.dev/read.txt?path=bendtorch@1.3.0.0/main.bend&start_line=3697&end_line=3707 import Base # the layout Train.dump gives, written from one array instead of a list (the same bytes) def Train.save(~P: Type, ~X: Type, ~Y: Type, ~S: Type, ~m: Layer
, +path: String, tr: Train
) -> IO(Train
): match tr: case Train{p, g, NoMom{}, +p1, +p2, +l}: 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)) case Train{p, g, OneMom{mm}, +p1, +p2, +l}: 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)) case Train{p, g, TwoMom{mm, vv}, +p1, +p2, +l}: 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)) case Train{p, g, Packed{t}, +p1, +p2, +l}: tsp(~P, ~X, ~Y, ~S, ~m, path, p, g, p1, p2, l, pt_cells(t)) Uses (19): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Array.new https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=F32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=IO https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.add https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.mul https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.to_nat https://jend.leeeet.dev/definition.txt?path=bendtorch@1.3.0.0/main.bend&name=Layer https://jend.leeeet.dev/definition.txt?path=bendtorch@1.3.0.0/main.bend&name=Layer.count https://jend.leeeet.dev/definition.txt?path=bendtorch@1.3.0.0/main.bend&name=Layer.store https://jend.leeeet.dev/definition.txt?path=bendtorch@1.3.0.0/main.bend&name=OptState https://jend.leeeet.dev/definition.txt?path=bendtorch@1.3.0.0/main.bend&name=Train https://jend.leeeet.dev/definition.txt?path=bendtorch@1.3.0.0/main.bend&name=depth https://jend.leeeet.dev/definition.txt?path=bendtorch@1.3.0.0/main.bend&name=pt_cells https://jend.leeeet.dev/definition.txt?path=bendtorch@1.3.0.0/main.bend&name=tsa_fin https://jend.leeeet.dev/definition.txt?path=bendtorch@1.3.0.0/main.bend&name=tsa_mm https://jend.leeeet.dev/definition.txt?path=bendtorch@1.3.0.0/main.bend&name=tsa_mv https://jend.leeeet.dev/definition.txt?path=bendtorch@1.3.0.0/main.bend&name=tsp