pub struct MultiHeadAttentionBuilder {
pub dims: i32,
pub num_heads: i32,
pub query_input_dims: Option<i32>,
pub key_input_dims: Option<i32>,
pub value_input_dims: Option<i32>,
pub value_dims: Option<i32>,
pub value_output_dims: Option<i32>,
pub bias: bool,
}
Expand description
Builder for the MultiHeadAttention
module
Fields§
§dims: i32
Model dimensions and default for the other dimensions if they are not supplied
num_heads: i32
Number of attention heads
query_input_dims: Option<i32>
Input dimensions of queries
key_input_dims: Option<i32>
Input dimensions of keys
value_input_dims: Option<i32>
Input dimensions of values
value_dims: Option<i32>
Dimensions of values after the projection
value_output_dims: Option<i32>
Dimensions new values will be projected to
bias: bool
If true
, use a bias in the Linear
layers
Implementations§
Source§impl MultiHeadAttentionBuilder
impl MultiHeadAttentionBuilder
Sourcepub fn query_input_dims(self, query_input_dims: impl Into<Option<i32>>) -> Self
pub fn query_input_dims(self, query_input_dims: impl Into<Option<i32>>) -> Self
Sets the value of [query_input_dims
].
Sourcepub fn key_input_dims(self, key_input_dims: impl Into<Option<i32>>) -> Self
pub fn key_input_dims(self, key_input_dims: impl Into<Option<i32>>) -> Self
Sets the value of [key_input_dims
].
Sourcepub fn value_input_dims(self, value_input_dims: impl Into<Option<i32>>) -> Self
pub fn value_input_dims(self, value_input_dims: impl Into<Option<i32>>) -> Self
Sets the value of [value_input_dims
].
Sourcepub fn value_dims(self, value_dims: impl Into<Option<i32>>) -> Self
pub fn value_dims(self, value_dims: impl Into<Option<i32>>) -> Self
Sets the value of [value_dims
].
Sourcepub fn value_output_dims(
self,
value_output_dims: impl Into<Option<i32>>,
) -> Self
pub fn value_output_dims( self, value_output_dims: impl Into<Option<i32>>, ) -> Self
Sets the value of [value_output_dims
].
Trait Implementations§
Source§impl Builder<MultiHeadAttention> for MultiHeadAttentionBuilder
impl Builder<MultiHeadAttention> for MultiHeadAttentionBuilder
Source§type Error = MultiHeadAttentionBuildError
type Error = MultiHeadAttentionBuildError
Error with building
Source§impl Clone for MultiHeadAttentionBuilder
impl Clone for MultiHeadAttentionBuilder
Source§fn clone(&self) -> MultiHeadAttentionBuilder
fn clone(&self) -> MultiHeadAttentionBuilder
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for MultiHeadAttentionBuilder
impl RefUnwindSafe for MultiHeadAttentionBuilder
impl Send for MultiHeadAttentionBuilder
impl Sync for MultiHeadAttentionBuilder
impl Unpin for MultiHeadAttentionBuilder
impl UnwindSafe for MultiHeadAttentionBuilder
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 moreSource§impl<T> IntoOption<T> for T
impl<T> IntoOption<T> for T
Source§fn into_option(self) -> Option<T>
fn into_option(self) -> Option<T>
Convert into an
Option
.