lstm
Syntax
Description
The long short-term memory (LSTM) operation allows a network to learn long-term dependencies between time steps in time series and sequence data.
Note
This function applies the deep learning LSTM operation todlarray
data. If you want to apply an LSTM operation within alayerGraph
object orLayer
array, use the following layer:
applies a long short-term memory (LSTM) calculation to inputY
= lstm(X
,H0
,C0
,weights
,recurrentWeights
,bias
)X
using the initial hidden stateH0
, initial cell stateC0
, and parametersweights
,recurrentWeights
, andbias
. The inputX
must be a formatteddlarray
. The outputY
is a formatteddlarray
with the same dimension format asX
, except for any'S'
dimensions.
Thelstm
function updates the cell and hidden states using the hyperbolic tangent function (tanh) as the state activation function. Thelstm
function uses the sigmoid function given by
as the gate activation function.
[
also returns the hidden state and cell state after the LSTM operation.Y
,hiddenState
,cellState
] = lstm(X
,H0
,C0
,weights
,recurrentWeights
,bias
)
[___] = lstm(___,'DataFormat',
also specifies the dimension formatFMT
)FMT
whenX
is not a formatteddlarray
. The outputY
is an unformatteddlarray
with the same dimension order asX
, except for any'S'
dimensions.
Examples
Input Arguments
Output Arguments
More About
Extended Capabilities
Version History
Introduced in R2019b
See Also
dlarray
|fullyconnect
|softmax
|dlgradient
|dlfeval
|gru
|attention