MmapFloatTensorData

Memory-mapped tensor data implementation that provides zero-copy access to tensor data stored in files.

This implementation wraps a region of a memory-mapped file, interpreting the bytes as little-endian 32-bit floats. It provides both:

  • Direct FloatBuffer access for high-performance vectorized operations

  • Standard TensorData get/set operations for compatibility

Parameters

T

the data type constraint extending DType

initialShape

the shape of the tensor

buffer

the underlying byte buffer (typically a MappedByteBuffer slice)

Constructors

Link copied to clipboard
constructor(initialShape: Shape, buffer: ByteBuffer)

Properties

Link copied to clipboard
open override val floatBuffer: FloatBuffer

FloatBuffer view of the underlying data. Uses little-endian byte order (standard for GGUF and most file formats).

Link copied to clipboard
open override val shape: Shape

The shape descriptor that defines the dimensionality and size of this tensor data.

Functions

Link copied to clipboard
open operator override fun get(vararg indices: Int): Float

Retrieves an element at the specified multidimensional indices.

Link copied to clipboard
open operator override fun set(vararg indices: Int, value: Float)

Setter