def tensors

bendtorch-load@1.3.0.0 · main.bend:583

import bendtorch-load@1.3.0.0/main.bend as BendtorchLoad
import Base

583# The tensors `layout` names, read from a safetensors file in its order into one array of n numbers (F32 as they are,
584# BF16 widened exactly). Each must be in the file with the shape given, as F32 or BF16, and the shapes must hold n
585# numbers in all; otherwise the program stops with a message naming the tensor. Other tensors in the file are ignored.
586def tensors(+path: String, +n: U32, +layout: List<&2, Entry>) -> IO(Array<F32>):
587  do IO<Array<F32>>:
588    require(U32.is_eq(St.total(layout), n), path ++ ": the layout holds " ++ U32.show(St.total(layout)) ++ " numbers, the model " ++ U32.show(n))
589    h : Header <- header(path)
590    tensors_from(path, h, n, layout)

Uses (17)

Used by (0)

No other definition uses this definition.