# Tensor Statistics

Every view in Tensormorph that shades, colors, or summarizes a tensor - the Architecture view's magnitude-heatmap shading, the Matrix/Heatmap view, the Inspector panel's summary card - draws from the same underlying set of **tile statistics**, computed once and reused everywhere rather than recomputed per view.

## What gets computed

For any region of a tensor (down to a single tile, up to the whole thing), Tensormorph maintains:

-   **Moments** - mean, variance/standard deviation, and higher moments where relevant.
-   **Extremes** - min, max, and absmax (the largest absolute value, which matters more than min/max alone for symmetric weight distributions).
-   **Norms** - L1 and squared-L2, the basis for magnitude shading and for [outlier](/docs/inspect-and-analyze/outliers-and-anomalies) detection.
-   **Special-value counts** - NaN count, Inf count, and zero count (the latter doubling as the basis for [sparsity](/docs/inspect-and-analyze/sparsity) measurement).
-   **A log-scale histogram** - the binned value distribution, which is what powers [Histograms and Distributions](/docs/inspect-and-analyze/histograms-and-distributions).

## Why "mergeable" matters

Tile statistics are **monoid-mergeable**: the statistics for a coarse region can be computed directly from the statistics of its constituent finer tiles, without ever re-reading the raw values underneath them.

This is what makes [level-of-detail streaming](/docs/core-concepts/level-of-detail-and-streaming) work for a trillion-parameter model: an overview of an entire layer doesn't require touching every scalar in it, only combining the already-computed statistics of its tiles. It also means a statistic is well-defined and cheap at *any* granularity - a single scalar, a tile, a tensor, or an entire model - using exactly the same aggregation logic throughout.

## Where statistics stop being enough

Tile statistics are deliberately cheap: they're designed to be computed once during indexing and reused everywhere. Some questions need more than that - effective rank, principal components, or pairwise similarity between two tensors require actually reading more of the underlying data, not just combining precomputed summaries. Tensormorph treats those as a distinct, explicitly-requested tier of analysis rather than something that happens automatically as you navigate; see [SVD, PCA and Effective Rank](/docs/inspect-and-analyze/svd-pca-and-effective-rank).

## Reading statistics in the Inspector

Selecting any node - a whole tensor, a tile, a row - shows its statistics in the Inspector panel's summary card. The same numbers are queryable directly through [TQL](/docs/reference/expressions-and-queries), so a question like "which layers have the largest absmax" is a query over already-computed statistics, not a scan over raw weights.

## Related resources

-   [Histograms and Distributions](/docs/inspect-and-analyze/histograms-and-distributions) - the log-histogram statistic, visualized.
-   [NaN and Inf Detection](/docs/inspect-and-analyze/nan-and-inf-detection) - built directly on the special-value counts above.
-   [Level of Detail and Streaming](/docs/core-concepts/level-of-detail-and-streaming) - how mergeable statistics enable LOD rendering.
