MCPcopy Create free account
hub / github.com/appdevforall/CodeOnTheGo / seq_keep

Method seq_keep

subprojects/llama.cpp/src/llama-memory-recurrent.cpp:250–280  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

248}
249
250void llama_memory_recurrent::seq_keep(llama_seq_id seq_id) {
251 uint32_t new_head = size;
252
253 for (uint32_t i = 0; i < size; ++i) {
254 if ((llama_seq_id) i != seq_id) {
255 cells[i].tail = -1;
256 }
257
258 if (!cells[i].has_seq_id(seq_id)) {
259 if (cells[i].pos >= 0) {
260 used--;
261 }
262
263 cells[i].pos = -1;
264 cells[i].src = -1;
265 cells[i].seq_id.clear();
266
267 if (new_head == size){
268 new_head = i;
269 }
270 } else {
271 cells[i].seq_id.clear();
272 cells[i].seq_id.insert(seq_id);
273 }
274 }
275
276 // If we freed up a slot, set head to it so searching can start there.
277 if (new_head != size && new_head < head) {
278 head = new_head;
279 }
280}
281
282void llama_memory_recurrent::seq_add(llama_seq_id seq_id, llama_pos p0, llama_pos p1, llama_pos shift) {
283 if (shift == 0) {

Callers

nothing calls this directly

Calls 3

has_seq_idMethod · 0.80
clearMethod · 0.65
insertMethod · 0.45

Tested by

no test coverage detected