BendtorchLoad.tensors: def of bendtorch-load@1.3.0.0 Import: import bendtorch-load@1.3.0.0/main.bend as BendtorchLoad Lines 583-590 of bendtorch-load@1.3.0.0/main.bend: https://jend.leeeet.dev/read.txt?path=bendtorch-load@1.3.0.0/main.bend&start_line=583&end_line=590 import Base # The tensors `layout` names, read from a safetensors file in its order into one array of n numbers (F32 as they are, # BF16 widened exactly). Each must be in the file with the shape given, as F32 or BF16, and the shapes must hold n # numbers in all; otherwise the program stops with a message naming the tensor. Other tensors in the file are ignored. def tensors(+path: String, +n: U32, +layout: List<&2, Entry>) -> IO(Array): do IO>: require(U32.is_eq(St.total(layout), n), path ++ ": the layout holds " ++ U32.show(St.total(layout)) ++ " numbers, the model " ++ U32.show(n)) h : Header <- header(path) tensors_from(path, h, n, layout) Uses (17): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Array 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=IO.bind https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String.append https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.is_eq https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.show https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Unit https://jend.leeeet.dev/definition.txt?path=bendtorch-load@1.3.0.0/main.bend&name=Entry https://jend.leeeet.dev/definition.txt?path=bendtorch-load@1.3.0.0/main.bend&name=Header https://jend.leeeet.dev/definition.txt?path=bendtorch-load@1.3.0.0/main.bend&name=St.total https://jend.leeeet.dev/definition.txt?path=bendtorch-load@1.3.0.0/main.bend&name=header https://jend.leeeet.dev/definition.txt?path=bendtorch-load@1.3.0.0/main.bend&name=require https://jend.leeeet.dev/definition.txt?path=bendtorch-load@1.3.0.0/main.bend&name=tensors_from