## models.TokenAttention


Attention from `[CLS]` to each feature token in the last block, per


Usage

``` python
models.TokenAttention()
```


row and head, from [AttentionCannFit.attention](models.AttentionCannFit.md#prospicio.models.AttentionCannFit.attention).


## Attributes

| Name | Description |
|----|----|
| [heads](#heads) | Number of heads. |
| [rows](#rows) | Number of rows. |
| [tokens](#tokens) | Feature tokens, in column order. |

------------------------------------------------------------------------


#### heads


Number of heads.


`heads: int`


------------------------------------------------------------------------


#### rows


Number of rows.


`rows: int`


------------------------------------------------------------------------


#### tokens


Feature tokens, in column order.


`tokens: list[str]`


## Methods

| Name | Description |
|----|----|
| [get()](#get) | Weight of token `token` (an index into [tokens](models.TokenAttention.md#prospicio.models.TokenAttention.tokens)) for [row](aggregate.Ledger.md#prospicio.aggregate.Ledger.row) |
| [mean()](#mean) | Mean weight per token over the rows and heads, or over [rows](aggregate.Ledger.md#prospicio.aggregate.Ledger.rows) |

------------------------------------------------------------------------


#### get()


Weight of token `token` (an index into [tokens](models.TokenAttention.md#prospicio.models.TokenAttention.tokens)) for [row](aggregate.Ledger.md#prospicio.aggregate.Ledger.row)


Usage

``` python
get(row, head, token)
```


and `head`. Per row and head the weights over the feature tokens and `[CLS]` itself sum to 1.


------------------------------------------------------------------------


#### mean()


Mean weight per token over the rows and heads, or over [rows](aggregate.Ledger.md#prospicio.aggregate.Ledger.rows)


Usage

``` python
mean(rows=None)
```


only: what the model attends to in a segment.


##### Parameters


`rows: list of int = None`  


##### Returns


`list of float`
