Ternary2BitTensorData
class Ternary2BitTensorData(initialShape: Shape, data: ByteArray, val scale: Float = 1.0f) : TernaryTensorData(source)
Ternary tensor data using 2-bit encoding compatible with TQ2_0 format.
Encoding scheme (matches GGUF TQ2_0):
0 → -1
1 → 0
2 → +1
3 → (reserved, treated as +1 for safety)
This is the simpler ternary format with 4 values per byte.
Parameters
initialShape
the shape of the tensor
data
the packed byte array (4 ternary values per byte)
scale
the scale factor for FP32 dequantization