<!--
{
  "availability" : [
    "iOS: 14.0.0 - 18.0.0",
    "iPadOS: 14.0.0 - 18.0.0",
    "macCatalyst: 14.0.0 - 18.0.0",
    "macOS: 11.0.0 - 15.0.0",
    "tvOS: 14.0.0 - 18.0.0",
    "visionOS: 1.0.0 - 2.0.0",
    "watchOS: 7.0.0 - 11.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "Accelerate",
  "identifier" : "/documentation/Accelerate/BNNSLayerParametersLSTM",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Accelerate"
    ],
    "preciseIdentifier" : "c:@SA@BNNSLayerParametersLSTM"
  },
  "title" : "BNNSLayerParametersLSTM"
}
-->

# BNNSLayerParametersLSTM

A structure that contains the parameters of a long short-term memory (LSTM) layer.

```
struct BNNSLayerParametersLSTM
```

## Overview

Use a [`BNNSLayerParametersLSTM`](/documentation/Accelerate/BNNSLayerParametersLSTM) structure to define the parameters of a long short-term memory (LSTM) operation.

## Topics

### Initializers

[`init(input_size:hidden_size:batch_size:num_layers:seq_len:dropout:lstm_flags:sequence_descriptor:input_descriptor:output_descriptor:input_gate:forget_gate:candidate_gate:output_gate:hidden_activation:)`](/documentation/Accelerate/BNNSLayerParametersLSTM/init(input_size:hidden_size:batch_size:num_layers:seq_len:dropout:lstm_flags:sequence_descriptor:input_descriptor:output_descriptor:input_gate:forget_gate:candidate_gate:output_gate:hidden_activation:))

Returns a new long short-term memory (LSTM) parameters structure from the specified parameters.

[`init()`](/documentation/Accelerate/BNNSLayerParametersLSTM/init())

Returns a new long short-term memory (LSTM) parameters structure.

### Instance Properties

[`input_size`](/documentation/Accelerate/BNNSLayerParametersLSTM/input_size)

The number of elements in the input.

[`hidden_size`](/documentation/Accelerate/BNNSLayerParametersLSTM/hidden_size)

The number of elements in the hidden state.

[`batch_size`](/documentation/Accelerate/BNNSLayerParametersLSTM/batch_size)

The number of input and output samples.

[`num_layers`](/documentation/Accelerate/BNNSLayerParametersLSTM/num_layers)

The number of stacked long short-term memory (LSTM) layers.

[`seq_len`](/documentation/Accelerate/BNNSLayerParametersLSTM/seq_len)

The size of the sequential input.

[`dropout`](/documentation/Accelerate/BNNSLayerParametersLSTM/dropout)

The dropout ratio to apply between long short-term memory (LSTM) layers.

[`lstm_flags`](/documentation/Accelerate/BNNSLayerParametersLSTM/lstm_flags)

Flags that control the behavior of a long short-term memory (LSTM) layer.

[`sequence_descriptor`](/documentation/Accelerate/BNNSLayerParametersLSTM/sequence_descriptor)

A 1D array of unsigned-integer elements that determines the batch size for each step.

[`input_descriptor`](/documentation/Accelerate/BNNSLayerParametersLSTM/input_descriptor)

Descriptors of the input, hidden input, and cell-state input data.

[`output_descriptor`](/documentation/Accelerate/BNNSLayerParametersLSTM/output_descriptor)

Descriptors of the output, hidden output, and cell-state output data.

[`input_gate`](/documentation/Accelerate/BNNSLayerParametersLSTM/input_gate)

The descriptor of the input gate, which uses default sigmoid activation.

[`forget_gate`](/documentation/Accelerate/BNNSLayerParametersLSTM/forget_gate)

The descriptor of the forget gate, which uses default sigmoid activation.

[`candidate_gate`](/documentation/Accelerate/BNNSLayerParametersLSTM/candidate_gate)

The descriptor of the candidate gate, which uses default tanh activation.

[`output_gate`](/documentation/Accelerate/BNNSLayerParametersLSTM/output_gate)

The descriptor of the output gate, which uses default sigmoid activation.

[`hidden_activation`](/documentation/Accelerate/BNNSLayerParametersLSTM/hidden_activation)

Hidden activation function, which uses default tanh activation.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)