Skip to main content

neura_decoder/
rope.rs

1use neura_graph::{Graph, Value};
2
3pub fn partial(graph: &Graph, value: Value, position: Value, base: Value, width: u32) -> Value {
4    let written = graph.shape(value).dims()[3];
5    let front = graph.slice(value, 3, 0, width);
6    let turned = graph.rope(front, Some(position), Some(base));
7    if written == width {
8        return turned;
9    }
10    let rest = graph.slice(value, 3, width, written - width);
11    graph.concat(&[turned, rest], 3)
12}