A recurrent neural network layer for inference on Metal Performance Shaders images.
- iOS 11.0+
- macOS 10.13+
- Mac Catalyst 13.0+
- tvOS 11.0+
- Metal Performance Shaders
MPSRNNImage specifies a recurrent neural network layer for inference on
MPSImage objects. Two types of recurrent layers are supported:
MPSRNNImage—Operates with convolutions on images.
MPSRNNMatrix—Operates on matrices.
You can use
MPSRNNImage to implement the latter by using 1 x 1 images, but due to image size restrictions and performance,
MPSRNNMatrix is the better choice for linear recurrent layers.
MPSRNNImage is initialized using either of the following:
MPSRNNDescriptorinstance, which further specifies the recurrent network layer.
An array of
MPSRNNDescriptorinstances, which specifies a stack of recurrent layers that can operate in parallel a subset of the inputs in a sequence of inputs and recurrent outputs.
Stacks with bidirectionally traversing encode functions don't support starting from a previous set of recurrent states. However, you can achieve this effect by defining two separate unidirectional stacks of layers, running the same input sequence on them separately (one forward and one backward), and ultimately combining the two result sequences.