Logical shape
TensorShape keeps dimensions and checked element-count semantics separate from any particular allocation or model file.
UAIX.LmRuntime / Package guide
Tensor shapes, data types, GGML storage traits, quantized-block metadata, and reference vector math.
Required For tensor layout and storage metadata
UAIX.LmRuntime.Tensors
Tensor shapes, data types, GGML storage traits, quantized-block metadata, and reference vector math.
Tensor descriptors, memory descriptors, layouts, and quantization metadata for pure C# local LLM runtime packages.
dotnet add package UAIX.LmRuntime.Tensors
<PackageReference Include="UAIX.LmRuntime.Tensors" />
Version policy: The documentation deliberately omits UAIX.LmRuntime package version numbers. Resolve and pin versions through your normal dependency-management and lock-file process.
Review the current package metadata, frameworks, dependencies, and downloads on NuGet ↗
None within the UAIX.LmRuntime package family.
TensorShape keeps dimensions and checked element-count semantics separate from any particular allocation or model file.
TensorTypeTraitsCatalog maps GGML storage identifiers to block element counts, block byte counts, logical data types, and quantization status.
VectorMath supplies small, legible operations useful for validation and parity checks; optimized model execution belongs in the kernel package.
These are the main entry points for this package. The generated reference below includes every documented type and member represented by public package XML documentation.
TensorShape
GgmlTensorType
TensorDataType
TensorTypeTraits
TensorTypeTraitsCatalog
QuantizedBlockTraits
ITensor
VectorMath
Examples use public package signatures documented on LMRuntime.com. Model paths, hashes, byte counts, prompts, and host-specific identifiers remain application inputs.
Derive element count and encoded byte length from a logical shape and GGML storage type.
using UAIX.LmRuntime.Tensors;
TensorShape shape = TensorShape.From(4_096, 4_096);
TensorTypeTraits traits = TensorTypeTraitsCatalog.Get(GgmlTensorType.Q4_0);
ulong byteLength = TensorTypeTraitsCatalog.ComputeByteLength(
GgmlTensorType.Q4_0,
checked((ulong)shape.ElementCount));
Console.WriteLine($"Elements: {shape.ElementCount:N0}");
Console.WriteLine($"Block elements: {traits.BlockElementCount}");
Console.WriteLine($"Block bytes: {traits.BlockByteCount}");
Console.WriteLine($"Encoded bytes: {byteLength:N0}");
Use span-based reference math without allocating intermediate arrays.
using UAIX.LmRuntime.Tensors;
ReadOnlySpan<float> left = [1.0f, 2.0f, 3.0f, 4.0f];
ReadOnlySpan<float> right = [0.5f, 0.25f, -1.0f, 2.0f];
float dot = VectorMath.Dot(left, right);
ReadOnlySpan<float> input = [1.0f, 2.0f, 3.0f, 4.0f];
ReadOnlySpan<float> weight = [1.0f, 1.0f, 1.0f, 1.0f];
Span<float> normalized = stackalloc float[input.Length];
VectorMath.RmsNorm(input, weight, normalized, epsilon: 1e-5f);
Query a quantized layout before accepting tensor dimensions or allocating a destination buffer.
using UAIX.LmRuntime.Tensors;
QuantizedBlockTrait trait = QuantizedBlockTraits.Get(GgmlTensorType.Q5_0);
Console.WriteLine(trait.GgmlType);
Console.WriteLine($"Elements per block: {trait.BlockElementCount}");
Console.WriteLine($"Bytes per block: {trait.BlockByteCount}");
Expand a type to review its documented fields, properties, constructors, methods, parameter descriptions, and return descriptions. Browser Find also works across the closed detail elements.
GgmlTensorTypeUAIX.LmRuntime.Tensors
21 members
Identifies GGML tensor storage types as encoded in GGUF tensor descriptors.
BF16
16-bit brain floating point.
F16
16-bit floating point.
F32
32-bit floating point.
F64
64-bit floating point.
I16
16-bit signed integer.
I32
32-bit signed integer.
I64
64-bit signed integer.
I8
8-bit signed integer.
IQ4_NL
IQ4_NL block quantization.
Q2_K
Q2_K block quantization.
Q3_K
Q3_K block quantization.
Q4_0
Q4_0 block quantization.
Q4_1
Q4_1 block quantization.
Q4_K
Q4_K block quantization.
Q5_0
Q5_0 block quantization.
Q5_1
Q5_1 block quantization.
Q5_K
Q5_K block quantization.
Q6_K
Q6_K block quantization.
Q8_0
Q8_0 block quantization.
Q8_1
Q8_1 block quantization.
Q8_K
Q8_K block quantization.
ITensorUAIX.LmRuntime.Tensors
2 members
Defines tensor metadata common to all backend placements.
DataType
Gets the tensor element representation.
Shape
Gets the tensor shape.
Q4_1BlockUAIX.LmRuntime.Tensors
3 members
Represents a Q4_1 quantized block descriptor.
Minimum
Gets the block minimum.
PackedValues
Gets the packed values.
Scale
Gets the block scale.
Q5_0BlockUAIX.LmRuntime.Tensors
3 members
Represents a Q5_0 quantized block descriptor.
HighBits
Gets the high-bit metadata.
PackedValues
Gets the packed low-bit values.
Scale
Gets the block scale.
Q5_1BlockUAIX.LmRuntime.Tensors
4 members
Represents a Q5_1 quantized block descriptor.
HighBits
Gets the high-bit metadata.
Minimum
Gets the block minimum.
PackedValues
Gets the packed low-bit values.
Scale
Gets the block scale.
Q8_1BlockUAIX.LmRuntime.Tensors
3 members
Represents a Q8_1 quantized block descriptor.
Scale
Gets the block scale.
Sum
Gets the block sum metadata.
Values
Gets the quantized values.
QuantizedBlockTraitUAIX.LmRuntime.Tensors
3 members
Describes a quantized block layout.
BlockByteCount
Gets the physical bytes in one block.
BlockElementCount
Gets the logical elements in one block.
GgmlType
Gets the GGML tensor type.
QuantizedBlockTraitsUAIX.LmRuntime.Tensors
1 member
Provides quantized block trait lookup.
Get(UAIX.LmRuntime.Tensors.GgmlTensorType)
Gets quantized block layout information for a GGML tensor type.
typeReturns: The QuantizedBlockTrait result produced by QuantizedBlockTraits.Get for this contract: Gets quantized block layout information for a GGML tensor type. It is published only after all documented validation and ownership transitions succeed.
TensorDataTypeUAIX.LmRuntime.Tensors
24 members
Identifies supported tensor element representations.
BFloat16
16-bit brain floating point.
Float16
16-bit IEEE floating point.
Float32
32-bit IEEE floating point.
Int16
16-bit signed integer.
Int32
32-bit signed integer.
Int64
64-bit signed integer.
Int8
8-bit signed integer.
IQ4_NL
GGML IQ4_NL block quantization.
MXFP4
MXFP4 packed floating-point storage.
NVFP4
NVFP4 packed floating-point storage.
Q2_K
GGML Q2_K block quantization.
Q3_K
GGML Q3_K block quantization.
Q4_0
GGML Q4_0 block quantization.
Q4_1
GGML Q4_1 block quantization.
Q4_K
GGML Q4_K block quantization.
Q5_0
GGML Q5_0 block quantization.
Q5_1
GGML Q5_1 block quantization.
Q5_K
GGML Q5_K block quantization.
Q6_K
GGML Q6_K block quantization.
Q8_0
GGML Q8_0 block quantization.
Q8_1
GGML Q8_1 block quantization.
TQ1_0
TQ1_0 ternary quantized storage.
TQ2_0
TQ2_0 ternary quantized storage.
Unknown
Unknown or unsupported tensor representation.
TensorShapeUAIX.LmRuntime.Tensors
3 members
Represents immutable tensor shape metadata.
Dimensions
Gets the tensor dimensions.
ElementCount
Gets the number of tensor elements.
From(long[])
Creates the result from the tensor shape after validating the supplied representation.
Returns: The TensorShape result produced by TensorShape.From for this contract: Creates the result from the tensor shape after validating the supplied representation. It is published only after all documented validation and ownership transitions succeed.
TensorTypeTraitsUAIX.LmRuntime.Tensors
5 members
Describes storage traits for a GGML tensor type.
BlockByteCount
Gets the number of physical bytes in one storage block.
BlockElementCount
Gets the number of logical elements in one physical storage block.
DataType
Gets the runtime tensor data type.
GgmlType
Gets the GGML tensor type.
IsQuantized
Gets a value indicating whether the type is block-quantized.
TensorTypeTraitsCatalogUAIX.LmRuntime.Tensors
2 members
Provides GGML tensor type trait lookup and byte-length validation.
ComputeByteLength(UAIX.LmRuntime.Tensors.GgmlTensorType,ulong)
Computes the physical byte length required for a tensor type and element count.
typeelementCountReturns: The ulong value computed by TensorTypeTraitsCatalog.ComputeByteLength for this contract: Computes the physical byte length required for a tensor type and element count. Range, finite-value, and overflow checks are completed before the value is returned.
Get(UAIX.LmRuntime.Tensors.GgmlTensorType)
Gets traits for the specified tensor type.
typeReturns: The TensorTypeTraits result produced by TensorTypeTraitsCatalog.Get for this contract: Gets traits for the specified tensor type. It is published only after all documented validation and ownership transitions succeed.
VectorMathUAIX.LmRuntime.Tensors
2 members
Provides allocation-free vector math kernels used by tests and CPU fallback paths.
Dot(System.ReadOnlySpan<float>,System.ReadOnlySpan<float>)
Computes the dot product of two equal-length vectors.
leftrightReturns: The float value computed by VectorMath.Dot for this contract: Computes the dot product of two equal-length vectors. Range, finite-value, and overflow checks are completed before the value is returned.
RmsNorm(System.ReadOnlySpan<float>,System.ReadOnlySpan<float>,System.Span<float>,float)
Applies RMS normalization using an explicit weight vector.
inputweightoutputepsilonNo. It calculates storage size from the registered block traits. Dequantization and matrix operations are in Kernels.Cpu.
Quantized formats encode a block of logical values into a smaller fixed-size block. Treating encoded bytes as scalar elements causes range, alignment, and allocation errors.
The interface describes shape and data type only. Concrete ownership and disposal rules belong to the implementing type.