Table of Contents

Class SparsePruningMetadata<T>

Namespace
AiDotNet.ModelCompression
Assembly
AiDotNet.dll

Metadata for sparse pruning compression.

public class SparsePruningMetadata<T> : ICompressionMetadata<T>

Type Parameters

T

The numeric type.

Inheritance
SparsePruningMetadata<T>
Implements
Inherited Members

Remarks

For Beginners: This metadata stores: - Indices of non-zero values (so we know where to put them during decompression) - Original vector length (to reconstruct the right size) - Threshold used (for reference) - Actual sparsity achieved (for statistics)

Constructors

SparsePruningMetadata(int[], int, double, double)

Initializes a new instance of the SparsePruningMetadata class.

public SparsePruningMetadata(int[] nonZeroIndices, int originalLength, double threshold, double actualSparsity)

Parameters

nonZeroIndices int[]
originalLength int
threshold double
actualSparsity double

Properties

ActualSparsity

Gets the actual sparsity achieved (fraction of zeros).

public double ActualSparsity { get; }

Property Value

double

NonZeroIndices

Gets the indices of non-zero values.

public int[] NonZeroIndices { get; }

Property Value

int[]

OriginalLength

Gets the original length of the weights array.

public int OriginalLength { get; }

Property Value

int

Threshold

Gets the threshold used for pruning.

public double Threshold { get; }

Property Value

double

Type

Gets the compression type.

public CompressionType Type { get; }

Property Value

CompressionType

Methods

GetMetadataSize()

Gets the size in bytes of this metadata structure.

public long GetMetadataSize()

Returns

long