pub struct QkvParamsBase<S, D = Ix2>{ /* private fields */ }Expand description
This object is designed to store the parameters of the QKV (Query, Key, Value)
Implementations§
Source§impl<A, S, D> QkvParamsBase<S, D>
impl<A, S, D> QkvParamsBase<S, D>
pub fn new( query: ArrayBase<S, D>, key: ArrayBase<S, D>, value: ArrayBase<S, D>, ) -> Self
pub fn from_elem<Sh: ShapeBuilder<Dim = D>>(shape: Sh, elem: A) -> Self
pub fn default<Sh: ShapeBuilder<Dim = D>>(shape: Sh) -> Self
pub fn ones<Sh: ShapeBuilder<Dim = D>>(shape: Sh) -> Self
pub fn zeros<Sh: ShapeBuilder<Dim = D>>(shape: Sh) -> Self
Sourcepub const fn key(&self) -> &ArrayBase<S, D>
pub const fn key(&self) -> &ArrayBase<S, D>
returns an immutable reference to the key parameters
Sourcepub fn key_mut(&mut self) -> &mut ArrayBase<S, D>
pub fn key_mut(&mut self) -> &mut ArrayBase<S, D>
returns a mutable reference to the key parameters
Sourcepub const fn query(&self) -> &ArrayBase<S, D>
pub const fn query(&self) -> &ArrayBase<S, D>
returns an immutable reference to the query parameters
Sourcepub fn query_mut(&mut self) -> &mut ArrayBase<S, D>
pub fn query_mut(&mut self) -> &mut ArrayBase<S, D>
returns a mutable reference to the query parameters
Sourcepub const fn value(&self) -> &ArrayBase<S, D>
pub const fn value(&self) -> &ArrayBase<S, D>
returns an immutable reference to the value parameters
Sourcepub fn value_mut(&mut self) -> &mut ArrayBase<S, D>
pub fn value_mut(&mut self) -> &mut ArrayBase<S, D>
returns a mutable reference to the value parameters
pub fn set_key(&mut self, key: ArrayBase<S, D>) -> &mut Self
pub fn set_query(&mut self, query: ArrayBase<S, D>) -> &mut Self
pub fn set_value(&mut self, value: ArrayBase<S, D>) -> &mut Self
pub fn with_key(self, key: ArrayBase<S, D>) -> Self
pub fn with_query(self, query: ArrayBase<S, D>) -> Self
pub fn with_value(self, value: ArrayBase<S, D>) -> Self
Trait Implementations§
Source§impl<X, Z, A, S, D> Forward<X> for QkvParamsBase<S, D>
This trait is used to implement the forward pass for the QKV parameters.
impl<X, Z, A, S, D> Forward<X> for QkvParamsBase<S, D>
This trait is used to implement the forward pass for the QKV parameters.
type Output = Z
Source§fn forward_then<F>(&self, input: &Rhs, then: F) -> Result<Self::Output, Error>
fn forward_then<F>(&self, input: &Rhs, then: F) -> Result<Self::Output, Error>
this method enables the forward pass to be generically activated using some closure.
This is useful for isolating the logic of the forward pass from that of the activation
function and is often used by layers and models.
Auto Trait Implementations§
impl<S, D> Freeze for QkvParamsBase<S, D>
impl<S, D> RefUnwindSafe for QkvParamsBase<S, D>
impl<S, D> Send for QkvParamsBase<S, D>
impl<S, D> Sync for QkvParamsBase<S, D>
impl<S, D> Unpin for QkvParamsBase<S, D>
impl<S, D> UnwindSafe for QkvParamsBase<S, D>
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