# testing.check_subset

``` python
testing.check_subset(subset, model, caps)
```

Check a subset against the core contracts.

- It returns a non-empty `Mapping` from parameter names of the module (tied aliases included) to the module’s own parameters under those names. A view of the whole parameter, such as `p.detach()`, counts; a copy does not.
- Or it returns a `Selection` whose `base` is such a mapping.
- It is deterministic: a second call selects the same names, in the same order, and the same tensors (and, for a `Selection`, the same entries).

## Parameters

| Name | Type | Description | Default |
|----|----|----|----|
| subset | Subset | The subset. | *required* |
| model | nn.Module \| ModelFn | The model, as a module or a `ModelFn` with a module. | *required* |
| caps | Capabilities | What the subset reads, usually the forward order from `lk.core.probe(fn, likelihood, batch, params={})`. | *required* |

## Raises

| Name | Type | Description |
|----|----|----|
|  | AssertionError | A law above fails. The message names the law and `subset`. |
|  | ValueError | `model` is a `ModelFn` without a module. |
|  | StructureError | Passed through from the subset, which raises it (or `CapabilityError`) when it has nothing to select, naming what is missing, as `subsets.named` does. |
|  | CapabilityError | Passed through from the subset, as above. |
