Constructor LSTM
LSTM(string, string[], string[], int, RnnDirection, RnnActivation[], float[], float[], float, bool, RnnLayout)
Initializes and returns an instance of a Long Short-Term Memory Network (LSTM
) recurrent layer.
Declaration
public LSTM(string name, string[] inputs, string[] outputs, int hiddenSize, RnnDirection direction, RnnActivation[] activations = null, float[] activationAlpha = null, float[] activationBeta = null, float clip = 3.4028235E+38, bool inputForget = false, RnnLayout layout = RnnLayout.SequenceFirst)
Parameters
Type |
Name |
Description |
string |
name |
The name to use for the first output tensor of the layer.
|
string[] |
inputs |
The names to use for the input tensors of the layer [X, W, R, (B, sequenceLens, initialH, initialC, P)].
X is the name of the input sequences tensor.
W is the name of the weights tensor for the gates of the LSTM.
R is the name of the recurrent weights tensor for the gates of the LSTM.
B is the name of the optional bias tensor for the input gate of the LSTM.
sequenceLens is the name of the optional 1D tensor specifying the lengths of the sequences in a batch.
initialH is the name of the optional initial values tensor of the hidden neurons of the LSTM. If this is `null` then 0 is used.
initialC is the name of the optional initial values tensor of the cells of the LSTM. If this is `null` then 0 is used.
P is the name of the optional weight tensor for the peepholes of the LSTM. If this is `null` then 0 is used.///
|
string[] |
outputs |
The names for the output tensors of the layer [Y, Y_h, Y_c].
Y is the name of the concatenated intermediate output values tensor of the hidden neurons.
Y_h is the name of the last output values tensor of the hidden neurons.
Y_c is the name of the last output values tensor of the cells.
|
int |
hiddenSize |
The number of neurons in the hidden layer of the LSTM.
|
RnnDirection |
direction |
The direction of the LSTM as an RnnDirection .
|
RnnActivation[] |
activations |
The activation functions of the LSTM as an array of RnnActivation . If this is null then the LSTM uses the corresponding defaults for the given activations.
|
float[] |
activationAlpha |
The alpha values of the activation functions of the LSTM.
If this is `null` then the LSTM uses [0, 0, 0...].
|
float[] |
activationBeta |
The beta values of the activation functions of the LSTM.
If this is `null` then the LSTM uses the corresponding defaults for the given activations.
|
float |
clip |
The cell clip threshold of the LSTM. The default value is float.MaxValue .
|
bool |
inputForget |
Whether to forget the input values in the LSTM. If this is false the input and forget gates are coupled. The default value is false .
|
RnnLayout |
layout |
The layout of the tensors as an RnnLayout . The default value is RnnLayout.SequenceFirst.
|
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.