Skip to main content

Module packer

Module packer 

Source
Expand description

LSB-first 32-bit binary matrix packing, unpacking, and compact 1-bit matmul.

Structs§

PackedBinaryMatrix
Row-major 1-bit packed matrix with values in {-1, +1}.

Functions§

binary_packer
Binarize a 2D Candle tensor (>= 0 => +1, < 0 => -1) and pack it into (packed_i32, shape_i64) tensors matching upstream binary_packer.
binary_unpacker
Unpack a 2D I32 packed Candle tensor back into a {-1, +1} tensor of target_dtype on device.
pack_i8_slice
Pack a row-major i8 matrix containing only -1 and +1 into PackedBinaryMatrix.
unpack_i32_slice
Unpack a raw slice of row-major 32-bit words back to {-1, +1} Vec<i8>.