MCPcopy Create free account
hub / github.com/evilsocket/cake / Cache

Class Cache

cake-core/src/models/common/cache.rs:9–26  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7/// Abstraction over cosine and sine tables, kv-caching and attention masking.
8#[derive(Debug, Clone)]
9pub struct Cache {
10 cos: Tensor,
11 sin: Tensor,
12
13 masks: HashMap<usize, Tensor>,
14 use_kv_cache: bool,
15 kvs: Vec<Option<(Tensor, Tensor)>>,
16 max_seq_len: usize,
17
18 /// Recurrent state matrices for linear attention layers (Gated DeltaNet).
19 /// Shape per entry: (batch=1, num_heads, key_dim, value_dim).
20 recurrent_states: Vec<Option<Tensor>>,
21 /// Conv1d history for linear attention layers.
22 /// Shape per entry: (batch=1, channels, kernel_size-1).
23 conv_states: Vec<Option<Tensor>>,
24
25 device: Device,
26}
27
28impl Cache {
29 /// Creates a new cache instance with the provided configuration.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected