---
title: "ClikaRT::io::SubsetSpec"
sidebar_label: "SubsetSpec"
description: "Which entries TensorsContainer::subset takes, and under which names the sub-container serves them."
---

<!-- Generated by tools/doxygen2mdx from Doxygen XML. Do not edit. -->

<span class="api-kind api-kind--struct">struct</span>

**Header:** `ClikaRT/io/tensors_container.h`

Which entries [`TensorsContainer::subset`](./TensorsContainer.md#subset) takes, and under which names the sub-container serves them.

## Types

### enum Match {#Match}

<div class="api-signature">

`enum class` **`Match`** `:` `std::uint8_t`

</div>

| Enumerator | Description |
| --- | --- |
| `Prefix` | [`text`](./SubsetSpec.md#text) is a name prefix (`"model.layers.3."`): an entry is taken when its name starts with it. With [`strip`](./SubsetSpec.md#strip) the prefix is removed from the name the sub-container serves (`"self_attn.q_proj.weight"`). |
| `Pattern` | [`text`](./SubsetSpec.md#text) is a regular expression (RE2 syntax) matched against the WHOLE name. With [`strip`](./SubsetSpec.md#strip) the name the sub-container serves is the pattern's first capture group (`"model\\.layers\\.3\\.(.*)"`), so the pattern must declare one; without [`strip`](./SubsetSpec.md#strip) the full name is kept, the pattern only selecting. |

<div class="api-declared">

Declared in `ClikaRT/io/tensors_container.h`, line 60

</div>

## Data members

### match {#match}

<div class="api-signature">

[`Match`](./SubsetSpec.md#Match) **`match`** `=` [`Match::Prefix`](./SubsetSpec.md#Match)

</div>

how [`text`](./SubsetSpec.md#text) selects entries

<div class="api-declared">

Declared in `ClikaRT/io/tensors_container.h`, line 72

</div>

### text {#text}

<div class="api-signature">

`std::string` **`text`**

</div>

the prefix, or the pattern

<div class="api-declared">

Declared in `ClikaRT/io/tensors_container.h`, line 73

</div>

### strip {#strip}

<div class="api-signature">

`bool` **`strip`** `= true`

</div>

shorten the served names (above)

<div class="api-declared">

Declared in `ClikaRT/io/tensors_container.h`, line 74

</div>

### return\_clone {#return_clone}

<div class="api-signature">

`bool` **`return_clone`** `= false`

</div>

`false` (the default): the taken entries MOVE out of the container into the sub-container, one owner per name, so the container's `names()` no longer lists them and a second `subset` of the same names is empty. `true`: the sub-container shares the entries and the container keeps serving them too, for a weight two modules bind (a tied embedding and head). Either way no tensor data is read or copied, and a weight read through both containers is one tensor.

<div class="api-declared">

Declared in `ClikaRT/io/tensors_container.h`, line 82

</div>
