pub struct Decoder<T: FloatBounds + ScalarOperand> { /* private fields */ }Expand description
Decoder component of the sequence-to-sequence model
Implementations§
Source§impl<T: FloatBounds + ScalarOperand> Decoder<T>
impl<T: FloatBounds + ScalarOperand> Decoder<T>
Sourcepub fn new(config: &Seq2SeqConfig<T>) -> NeuralResult<Self>
pub fn new(config: &Seq2SeqConfig<T>) -> NeuralResult<Self>
Build a new decoder from the given Seq2Seq configuration
Sourcepub fn decode_step(
&mut self,
input_token: &Array1<usize>,
_hidden_states: &mut Vec<Array2<T>>,
_cell_states: &mut Vec<Array2<T>>,
encoder_output: Option<&EncoderOutput<T>>,
attention: Option<&mut AttentionMechanism<T>>,
) -> NeuralResult<Array2<T>>
pub fn decode_step( &mut self, input_token: &Array1<usize>, _hidden_states: &mut Vec<Array2<T>>, _cell_states: &mut Vec<Array2<T>>, encoder_output: Option<&EncoderOutput<T>>, attention: Option<&mut AttentionMechanism<T>>, ) -> NeuralResult<Array2<T>>
Decode one step given input token and previous hidden states
Sourcepub fn decode_greedy(
&mut self,
encoder_output: &EncoderOutput<T>,
max_length: usize,
start_token: usize,
end_token: usize,
attention: Option<&mut AttentionMechanism<T>>,
) -> NeuralResult<Array2<usize>>
pub fn decode_greedy( &mut self, encoder_output: &EncoderOutput<T>, max_length: usize, start_token: usize, end_token: usize, attention: Option<&mut AttentionMechanism<T>>, ) -> NeuralResult<Array2<usize>>
Decode full sequence using greedy decoding
Auto Trait Implementations§
impl<T> !RefUnwindSafe for Decoder<T>
impl<T> !Send for Decoder<T>
impl<T> !Sync for Decoder<T>
impl<T> !UnwindSafe for Decoder<T>
impl<T> Freeze for Decoder<T>
impl<T> Unpin for Decoder<T>
impl<T> UnsafeUnpin for Decoder<T>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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