tensor

fun tensor(name: String, dtype: String, shape: List<Long>, dataProvider: () -> ByteArray)(source)

Add a tensor to the file.

Parameters

name

Tensor name (e.g., "model.layer.weight")

dtype

SafeTensors dtype string (e.g., "F32", "F16", "I32")

shape

Tensor dimensions

dataProvider

Lambda that returns the raw tensor data bytes


fun tensor(name: String, dtype: String, shape: IntArray, dataProvider: () -> ByteArray)(source)

Add a tensor with Int shape dimensions.