# Introspection

> USearch for Python

```python
index.count(42)  # entries sharing this key
42 in index  # the same question, as a membership test
len(index)  # stored entries
index.describe()  # a DenseIndexDescription: .metadata, .size, .capacity, .memory_usage, .cpu_class, .gpu_class, .shards_count
index.health()  # a DenseReachability: .audited, .reachable, .sweeps
index.cpu_class  # the CPU class dispatch picked on this machine
usearch.capabilities_compiled()  # the kernel families this build carries
usearch.capabilities_available()  # the ones this machine can run
```

`capacity`, `dimensions`, `connectivity` and `memory_usage` are properties read through `describe` as well.
`health` audits how much of the graph a search reaches, and the entries it cannot reach wait for a `refine` to re-link them.
Every docstring names the C symbol it calls, or says the method is Python-only.

`import usearch`

`from usearch import DenseIndexDescription, DenseReachability`

## CPUClass

The CPU families dispatch picks from; a placement may pin one.

```python
class CPUClass(IntEnum)
```

- `SERIAL` = `1`: The portable floor: no SIMD assumptions.
- `INTEL_HASWELL` = `2`: Haswell-class x86: AVX2 and FMA, the 256-bit floor.
- `INTEL_SIERRA` = `3`: Sierra Forest-class x86, the E-core Xeons: AVX-VNNI without AVX-512.
- `INTEL_SKYLAKE` = `4`: Skylake-class x86: the AVX-512 foundation tier.
- `INTEL_ICELAKE` = `5`: Icelake-class x86: AVX-512 VNNI and VPOPCNT.
- `AMD_GENOA` = `6`: Genoa-class x86, Zen 4 and newer: native bf16 dot products over AVX-512.
- `INTEL_SAPPHIRE` = `7`: Sapphire Rapids-class x86: the Genoa bundle plus AVX-512 FP16 and AMX tiles.
- `INTEL_GRANITE` = `8`: Granite Rapids-class x86: the Sapphire Rapids bundle plus AMX-FP16 tiles.
- `INTEL_DIAMOND` = `9`: Diamond Rapids-class x86: the Granite Rapids bundle plus AVX10.2 FP8 conversions.
- `AWS_G2` = `10`: Graviton2-class Arm, Neoverse N1: the bare NEON floor.
- `APPLE_M2` = `11`: Armv8.6 NEON with dot products and bf16 and f16 fused multiplies, as in Apple M2.
- `APPLE_M4` = `12`: Apple M4-class Arm: the Armv8.6 NEON bundle plus SME outer-product tiles.
- `AWS_G5` = `13`: Graviton5-class Arm, Neoverse V3 and Armv9.2: monitored waits.
- `NVIDIA_VERA` = `14`: Vera-class Arm: NVIDIA's Armv9.2-generation cores with FP8 dot products.
- `ALIBABA_C930` = `15`: Alibaba C930-class RISC-V, RVA23: vectors with Zvbb, monitored waits.
- `WASM32_V128` = `16`: WebAssembly every engine loads: 32-bit, single-threaded, simd128.
- `WASM64_EXTENDED` = `17`: WebAssembly with relaxed SIMD, shared memory and 64-bit addressing.
- `MONOVERSIONED` = `18`: The one class of a monoversioned build, carrying every capability its floor implies.

## GPUClass

The GPU families dispatch picks from; a placement may pin one.

```python
class GPUClass(IntEnum)
```

- `NVIDIA_AMPERE` = `1`: Ampere-class NVIDIA and every NVIDIA GPU without a class of its own: A100, A10, RTX 30.
- `NVIDIA_ADA` = `2`: Ada-class NVIDIA: L4, L40S and RTX 40, with fp8 conversions.
- `NVIDIA_HOPPER` = `3`: Hopper-class NVIDIA: H100 and H200, with DPX instructions.
- `NVIDIA_BLACKWELL` = `4`: Blackwell-class NVIDIA: B200, B300 and GB300, with TMA gather4 fetches.
- `NVIDIA_BLACKWELLRTX` = `5`: Consumer Blackwell NVIDIA: RTX 50, RTX PRO 6000 and DGX Spark.
- `NVIDIA_RUBIN` = `6`: Rubin-class NVIDIA, the Vera-Rubin platform's device half.
- `AMD_CDNA3` = `7`: CDNA3 AMD: MI300X and MI325X, 64-wide waves, FNUZ fp8.
- `AMD_CDNA4` = `8`: CDNA4 AMD: MI350X and MI355X, OCP fp8.
- `AMD_CDNA5` = `9`: CDNA5 AMD: MI400, 32-wide waves.
- `APPLE_METAL7` = `10`: Apple7-family GPUs and every Apple GPU without a class of its own: M1 and M2.
- `APPLE_METAL9` = `11`: Apple9-family GPUs: M3 and M4.
- `APPLE_METAL10` = `12`: Apple10-family GPUs: M5, with Neural Accelerator matrix units.

## NVMeClass

The I/O engines NVMe executors submit through; an executor may pin one.

```python
class NVMeClass(IntEnum)
```

- `POSIX` = `1`: Blocking reads on the calling thread.
- `LINUX_AIO` = `2`: Linux AIO with direct I/O.
- `LINUX_URING` = `3`: io_uring reads on files and block devices.
- `LINUX_URING_PASSTHROUGH` = `4`: io_uring NVMe passthrough on namespace character devices, such as "/dev/ng0n1".
- `LINUX_SPDK` = `5`: The SPDK user-space driver, over namespaces named by transport identifiers.
- `WINDOWS_IORING` = `6`: I/O Rings, on Windows 11 22H2 and newer.

## DenseIndexDescription

A live index's frozen metadata and current counters.

```python
class DenseIndexDescription(structseq[Any], tuple[DenseMetadata, int, int, int, CPUClass | None, GPUClass | None, int])
```

## metadata

The frozen [`DenseMetadata`](https://www.unum.cloud/docs/usearch/python/serialization.md#DenseMetadata), as a checkpoint reports it.

```python
metadata: DenseMetadata
```

## size

Stored entries.

```python
size: int
```

## capacity

Entries hosted without growing again.

```python
capacity: int
```

## memory_usage

Bytes the handle holds; traversal scratch is the executor's.

```python
memory_usage: int
```

## cpu_class

The [`CPUClass`](#CPUClass) dispatch picked on this machine, or None.

```python
cpu_class: CPUClass | None
```

## gpu_class

The [`GPUClass`](#GPUClass) dispatch picked on the index's devices, or None for a host index.

```python
gpu_class: GPUClass | None
```

## shards_count

Live shards.

```python
shards_count: int
```

## DenseReachability

One reachability audit.

```python
class DenseReachability(structseq[Any], tuple[int, int, int, int])
```

## audited

Entries published when the audit started, the population it judged.

```python
audited: int
```

## reachable

Of those, the entries a search reaches; the rest wait for a [`refine`](https://www.unum.cloud/docs/usearch/python/metrics.md#refine) to re-link them.

```python
reachable: int
```

## sweeps

Levels the sweep took to converge.

```python
sweeps: int
```

## back_sweeps

Levels the sweep back toward the entry point took, where an audit sweeps both ways.

```python
back_sweeps: int
```

## version

The library's semantic version.

```python
def version() -> str
```

## capabilities_compiled

The kernel families this build carries.

```python
def capabilities_compiled() -> str
```

## capabilities_available

The kernel families this machine can run.

```python
def capabilities_available() -> str
```

## layouts

The size and field offsets of every argument struct the other bindings lay out by hand.

```python
def layouts() -> dict[str, tuple[int, dict[str, int]]]
```

