pub struct CrossAttention {
pub w_q: Tensor,
pub w_k: Tensor,
pub w_v: Tensor,
pub w_o: Tensor,
pub num_heads: usize,
pub d_k: usize,
pub d_model: usize,
}Expand description
Cross-attention: query from decoder, key/value from encoder output.
Stores separate projection matrices for Q (applied to decoder state) and K/V (applied to encoder memory).
Fields§
§w_q: Tensor§w_k: Tensor§w_v: Tensor§w_o: Tensor§num_heads: usize§d_k: usize§d_model: usizeImplementations§
Auto Trait Implementations§
impl Freeze for CrossAttention
impl RefUnwindSafe for CrossAttention
impl Send for CrossAttention
impl Sync for CrossAttention
impl Unpin for CrossAttention
impl UnsafeUnpin for CrossAttention
impl UnwindSafe for CrossAttention
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more