---
title: MPSRNNSingleGateDescriptor
framework: metalperformanceshaders
role: symbol
role_heading: Class
path: metalperformanceshaders/mpsrnnsinglegatedescriptor
---

# MPSRNNSingleGateDescriptor

A description of a simple recurrent block or layer.

## Declaration

```swift
class MPSRNNSingleGateDescriptor
```

## Overview

Overview The recurrent neural network (RNN) layer initialized with a MPSRNNSingleGateDescriptor transforms the input data (image or matrix) and previous output with a set of filters. Each produces one feature map in the new output data. You may provide the RNN unit with a single input or a sequence of inputs. Description of Operation Let x_j be the input data (at time index t of sequence, j index containing quadruplet: batch index, x,y and feature index (x = y = 0 for matrices)). Let h0_j be the recurrent input (previous output) data from previous time step (at time index t-1 of sequence). Let h1_i be the output data produced at this time step. Let W_ij, U_ij be the weights for input and recurrent input data, respectively. Let b_i be a bias term. Let gi(x) be a neuron activation function. The new output image h1_i data is computed as follows: h1_i = gi( W_ij * x_j + U_ij * h0_j  + b_i ) The * stands for convolution (see MPSRNNImageInferenceLayer) or matrix-vector/matrix multiplication (see MPSRNNMatrixInferenceLayer). Summation is over index j (except for the batch index), but there’s no summation over repeated index i (the output index). Note that for validity, all intermediate images must be of same size, and the U matrix must be square (that is, outputFeatureChannels == inputFeatureChannels). Also, the bias terms are scalars with regard to spatial dimensions.

## Topics

### Instance Properties

- [inputWeights](metalperformanceshaders/mpsrnnsinglegatedescriptor/inputweights.md)
- [recurrentWeights](metalperformanceshaders/mpsrnnsinglegatedescriptor/recurrentweights.md)
- [MPSCNNConvolutionDataSource](metalperformanceshaders/mpscnnconvolutiondatasource.md)

### Type Methods

- [createRNNSingleGateDescriptor(withInputFeatureChannels:outputFeatureChannels:)](metalperformanceshaders/mpsrnnsinglegatedescriptor/creaternnsinglegatedescriptor(withinputfeaturechannels:outputfeaturechannels:).md)

## Relationships

### Inherits From

- [MPSRNNDescriptor](metalperformanceshaders/mpsrnndescriptor.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)

## See Also

### Recurrent Neural Networks

- [MPSRNNImageInferenceLayer](metalperformanceshaders/mpsrnnimageinferencelayer.md)
- [MPSRNNMatrixInferenceLayer](metalperformanceshaders/mpsrnnmatrixinferencelayer.md)
- [MPSGRUDescriptor](metalperformanceshaders/mpsgrudescriptor.md)
- [MPSLSTMDescriptor](metalperformanceshaders/mpslstmdescriptor.md)
- [MPSRNNSequenceDirection](metalperformanceshaders/mpsrnnsequencedirection.md)
- [MPSRNNMatrixTrainingLayer](metalperformanceshaders/mpsrnnmatrixtraininglayer.md)
- [MPSRNNMatrixTrainingState](metalperformanceshaders/mpsrnnmatrixtrainingstate.md)
