WeightTensor

data class WeightTensor<T : DType, V>(val name: String, val shape: List<Int>, val tensor: Tensor<T, V>, val isBias: Boolean = name.lowercase().contains("bias"))(source)

Format-agnostic representation of a weight tensor loaded from any model format (ONNX, GGUF, SafeTensors, etc.).

This abstraction allows the weight mapping logic to be decoupled from the specific serialization format, enabling code reuse across different loaders.

Constructors

Link copied to clipboard
constructor(name: String, shape: List<Int>, tensor: Tensor<T, V>, isBias: Boolean = name.lowercase().contains("bias"))

Properties

Link copied to clipboard

Whether this tensor represents a bias parameter (auto-detected from name)

Link copied to clipboard

The original name of the tensor as stored in the model file

Link copied to clipboard
val shape: List<Int>

The dimensions of the tensor

Link copied to clipboard
val tensor: Tensor<T, V>

The actual tensor data