% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/DecoderRNN.R
\name{DecoderRNN}
\alias{DecoderRNN}
\title{DecoderRNN Neural Network Module}
\usage{
DecoderRNN(input_size, nhidden, nlayers, dropout)
}
\arguments{
\item{input_size}{A numeric value representing the number of features in the input data.}

\item{nhidden}{A numeric value representing the number of hidden units in each LSTM layer.}

\item{nlayers}{A numeric value indicating the number of LSTM layers.}

\item{dropout}{A numeric value between 0 and 1 indicating the dropout probability to be applied between LSTM layers.}
}
\value{
A tensor representing the output sequence, flipped along the sequence dimension.
}
\description{
A neural network module implementing a decoder using an LSTM architecture, based on the \code{torch} package. This module is typically used in sequence-to-sequence tasks during the decoding phase.
}
\section{Usage}{

\preformatted{
DecoderRNN <- nn_module(
  "DecoderRNN",

  initialize = function(input_size, nhidden, nlayers, dropout) {
    ...
  },

  forward = function(x, h) {
    ...
  }
)
}
}

\section{Methods}{

\describe{
\item{\code{initialize(input_size, nhidden, nlayers, dropout)}}{
Initializes the \code{DecoderRNN} module.

\if{html}{\out{<div class="sourceCode">}}\preformatted{\\itemize\{
  \\item\{\code{input_size}: A numeric value representing the number of features in the input data.\}
  \\item\{\code{nhidden}: A numeric value representing the number of hidden units in each LSTM layer.\}
  \\item\{\code{nlayers}: A numeric value indicating the number of LSTM layers.\}
  \\item\{\code{dropout}: A numeric value between 0 and 1 indicating the dropout probability to be applied between LSTM layers.\}
\}
}\if{html}{\out{</div>}}

}

\item{\code{forward(x, h)}}{
Executes the forward pass of the \code{DecoderRNN} module.

\if{html}{\out{<div class="sourceCode">}}\preformatted{\\itemize\{
  \\item\{\code{x}: A tensor of shape \code{(batch_size, sequence_length, input_size)} representing the input data.\}
  \\item\{\code{h}: A list containing the hidden state (\code{hn}) and cell state (\code{cn}) from the LSTM, typically passed from the encoder or previous decoder step.\}
\}

\\value\{
  A tensor representing the output sequence, flipped along the sequence dimension.
\}
}\if{html}{\out{</div>}}

}
}
}

\examples{
\donttest{
dec <- DecoderRNN(input_size = 4L, nhidden = 8L, nlayers = 1L, dropout = 0.0)
enc <- EncoderRNN(input_size = 4L, nhidden = 8L, nlayers = 1L, dropout = 0.0)
x   <- torch::torch_randn(2L, 1L, 4L)
enc_out <- enc(x)
dec_out <- dec(enc_out[[3]], enc_out[[2]])
}
}
