pub struct GraphBlockRoute<'a> {
pub q: &'a [f32],
pub k: &'a [f32],
pub q_norm: &'a [f32],
pub k_norm: &'a [f32],
pub block: usize,
pub prefix: usize,
pub local: usize,
pub remote: usize,
}Expand description
One layer’s block router (Maxwell-V1-Flash, maxwell::route_blocks): a
query attends to the first prefix blocks of block positions, to its
own block and the local - 1 before it, and to at most remote blocks
in between, chosen for each KV group by the block’s largest token score
q_g · k_t (ties to the lower block). q [nkv·hd, hidden] and k
[hd, hidden] project the layer’s normed input; both are normed a head
(q_norm, k_norm, the layer’s epsilon) and rotated as the layer’s
queries and keys are. While the blocks in between do not outnumber
remote every position is attended and the router does not run.
Fields§
§q: &'a [f32]§k: &'a [f32]§q_norm: &'a [f32]§k_norm: &'a [f32]§block: usize§prefix: usize§local: usize§remote: usizeImplementations§
Source§impl GraphBlockRoute<'_>
impl GraphBlockRoute<'_>
Sourcepub fn dense_range(&self) -> usize
pub fn dense_range(&self) -> usize
Positions below which a query attends to its whole past.
Trait Implementations§
Source§impl<'a> Clone for GraphBlockRoute<'a>
impl<'a> Clone for GraphBlockRoute<'a>
impl<'a> Copy for GraphBlockRoute<'a>
Auto Trait Implementations§
impl<'a> Forget for GraphBlockRoute<'a>
impl<'a> Freeze for GraphBlockRoute<'a>
impl<'a> Move for GraphBlockRoute<'a>
impl<'a> RefUnwindSafe for GraphBlockRoute<'a>
impl<'a> Send for GraphBlockRoute<'a>
impl<'a> Sync for GraphBlockRoute<'a>
impl<'a> Unpin for GraphBlockRoute<'a>
impl<'a> UnsafeUnpin for GraphBlockRoute<'a>
impl<'a> UnwindSafe for GraphBlockRoute<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more