import { TensorSliceSample } from './tensor-slice.js'; import { AxisMetric } from './weight-axis-stats.js'; import { WeightDiagnosticFinding } from './weight-diagnostics.js'; import { WeightDistribution } from './weight-distribution.js'; import { KernelAxisMapping } from './weight-kernel.js'; import { QuantizationInspection, Q4_0BlockInspection } from './weight-quantization.js'; import { SparsitySummary } from './weight-sparsity.js'; import { TensorOrder } from '@wetron/common/ir'; import { D as DecodedWeight, N as NumericWeight } from './weight-decoder-DMScCVae.js'; import './tensor-index.js'; interface WeightStats { readonly count: number; readonly min: number; readonly max: number; readonly mean: number; readonly std: number; readonly zeros: number; /** 12 fixed-width bins between min and max. */ readonly histogram: readonly number[]; /** 16 cols x 8 rows of mean-of-chunk values, length 128. */ readonly heatmap: readonly number[]; /** number of consecutive values averaged per heatmap cell. */ readonly chunkSize: number; /** * Number of heatmap cells that contain real data. * Cells beyond this index are zero-padded and should be treated as empty. * Always <= 128. Equal to 128 when the tensor has >= 128 elements. */ readonly filledCells: number; } interface WeightInspectionBase { readonly tensor: { readonly name: string; readonly shape: readonly number[] | null; readonly dtype: string | null; /** Memory order of the payload. Absent means row-major. */ readonly order?: TensorOrder; }; } type WeightInspectionData = WeightInspectionBase & ({ readonly status: 'deferred' | 'external' | 'unavailable'; readonly bytes: null; readonly values: null; readonly stats: null; } | { readonly status: 'unsupported'; readonly bytes: Uint8Array; readonly values: null; readonly stats: null; } | { readonly status: 'ready'; readonly bytes: Uint8Array; readonly values: DecodedWeight; readonly numeric: NumericWeight; readonly stats: WeightStats; }); type InspectorName = 'matrix' | 'distribution' | 'axis' | 'sparsity' | 'kernel' | 'quantization' | 'diagnostics' | 'values'; /** Inspectors offered for a tensor, in picker order. */ declare function availableInspectors(inspection: Pick): readonly InspectorName[]; /** Inspector to open a tensor with. */ declare function defaultInspector(shape: readonly number[] | null): InspectorName; /** Display text for the inspector picker. */ declare function inspectorLabel(name: InspectorName): string; /** Explains the summary block above the inspectors, which never changes with the view. */ declare function weightStatsHint(stats: WeightStats): string; /** One line describing what an inspector is for, shown beside the view picker. */ declare function inspectorViewHint(name: InspectorName): string; /** Option text pairing an axis with its extent, e.g. "axis 0 ยท 288". */ declare function axisOptionLabel(axis: number, shape: readonly number[]): string; declare function matrixAxisHint(kind: 'row' | 'col'): string; declare function matrixSampleHint(sample: TensorSliceSample): string; declare function matrixScaleHint(sample: TensorSliceSample): string; declare function distributionScaleHint(bins: number): string; declare function distributionDomainHint(): string; declare function distributionApproximateHint(distribution: WeightDistribution): string; declare function axisProfileAxisHint(): string; declare function axisMetricHint(metric: AxisMetric): string; declare function axisExcludedHint(excluded: number, sliceLength: number): string; declare function sparsityModeHint(): string; declare function sparsityZeroHint(summary: SparsitySummary, dtype: string | null): string; declare function sparsityDeadHint(summary: SparsitySummary, axis: number): string; declare function sparsityBlockHint(blockRows: number, blockCols: number): string; declare function kernelLayoutHint(shape: readonly number[]): string; declare function kernelInputHint(shape: readonly number[], mapping: KernelAxisMapping): string; declare function kernelL2Hint(shape: readonly number[], mapping: KernelAxisMapping, input: number): string; declare function kernelPageLabel(start: number, pageSize: number, total: number): string; type QuantizationField = 'block' | 'format' | 'levels' | 'blockSize' | 'trailingBytes' | 'scale' | 'saturation' | 'zeroCode' | 'histogram'; declare function quantizationHint(field: QuantizationField, result: QuantizationInspection, block: Q4_0BlockInspection | null): string; declare function diagnosticCodeHint(finding: WeightDiagnosticFinding, axis: number): string; export { type InspectorName, type QuantizationField, availableInspectors, axisExcludedHint, axisMetricHint, axisOptionLabel, axisProfileAxisHint, defaultInspector, diagnosticCodeHint, distributionApproximateHint, distributionDomainHint, distributionScaleHint, inspectorLabel, inspectorViewHint, kernelInputHint, kernelL2Hint, kernelLayoutHint, kernelPageLabel, matrixAxisHint, matrixSampleHint, matrixScaleHint, quantizationHint, sparsityBlockHint, sparsityDeadHint, sparsityModeHint, sparsityZeroHint, weightStatsHint };