~/bend-docscommunity

test/read.bend relies on unsafe/foreign

raw source on the hub · import bend-safetensors-reader@0.1.0.0/test/read.bend as Read

For each tensor name given after the file, reads the tensor with St.read and (for F32, BF16, F16) St.read_f32, and prints the cell count, the wrapping sum and the xor of the cells of each. test/check_read.py computes the same from the file with NumPy.

4 imports
import Base
import ../w64.bend as W
import ../header.bend as H
import ../st.bend as ST

Types

type Sum source · line 9 · raw

Data

Definitions

def sum_show source · line 26 · raw

@+n:U32 -> @r:Sum -> String

Unsafe

unsafe fold source · line 13 · raw

@done:Bool -> @+k:U32 -> @+n:U32 -> @a:Array<U32> -> @+s:U32 -> @+x:U32 -> Sum

unsafe fold_get source · line 21 · raw

@+k:U32 -> @+n:U32 -> @+s:U32 -> @+x:U32 -> @r:Pair(Array<U32>, U32) -> Sum

unsafe sums source · line 32 · raw

@+n:U32 -> @a:Array<U32> -> String

unsafe f32_part source · line 36 · raw

@ok:Bool -> @+s:0xd8619c297e019f1c512e443a1b7ff426/st.St -> @+e:0xd8619c297e019f1c512e443a1b7ff426/header.Ent -> IO(String)

unsafe one source · line 46 · raw

@+s:0xd8619c297e019f1c512e443a1b7ff426/st.St -> @+name:String -> @m:Maybe<&2, 0xd8619c297e019f1c512e443a1b7ff426/header.Ent> -> IO(Unit)

unsafe each source · line 57 · raw

@+s:0xd8619c297e019f1c512e443a1b7ff426/st.St -> @names:List<&1, String> -> IO(Unit)

unsafe opened source · line 67 · raw

@names:List<&1, String> -> @r:Result<&2, &2, String, 0xd8619c297e019f1c512e443a1b7ff426/st.St> -> IO(Unit)

unsafe arg source · line 75 · raw

@xs:List<&1, String> -> IO(Unit)

unsafe main source · line 85 · raw

IO(Unit)