Objects that Simplify the Creation of Neural Networks

Simplify the creation of neural networks using networks of filter, image, and state nodes.

Overview

Graphs in Metal Performance Shaders offer a higher level graph API, intended to simplify the creation of neural networks. The graph is a network of MPSNNFilterNode, MPSNNImageNode and MPSNNStateNode objects.

  • MPSNNImageNode represents MPSImage or MPSTemporaryImage objects

  • MPSNNFilterNode represents MPSCNNKernel objects—each of the lower level MPSCNNKernel subclasses has an associated object that is a subclass of the MPSNNFilterNode

  • MPSNNStateNode represents MPSState objects

Topics

Neural Network Graphs

MPSNNGraph

An optimized representation of a graph of neural network image and filter nodes.

MPSNNImageNode

A placeholder node denoting the position of a neural network image in a graph.

MPSHandle

The protocol that provides resource identification.

Arithmetic Layer Nodes

MPSNNAdditionNode

A representation of an addition operator.

MPSNNAdditionGradientNode

A representation of a gradient addition operator.

MPSNNSubtractionNode

A representation of an subtraction operator.

MPSNNSubtractionGradientNode

A representation of a gradient subtraction operator.

MPSNNMultiplicationNode

A representation of a multiplication operator.

MPSNNMultiplicationGradientNode

A representation of a gradient multiplication operator.

MPSNNDivisionNode

A representation of a division operator.

MPSNNBinaryArithmeticNode

Virtual base class for basic arithmetic nodes.

MPSNNArithmeticGradientNode

A representation of the base class for gradient arithmetic operators.

MPSNNArithmeticGradientStateNode

A representation of the clamp mask used by gradient arithmetic operators.

Convolution Layer Nodes

MPSCNNBinaryConvolutionNode

A representation of a convolution kernel with binary weights and an input image using binary approximations.

MPSCNNConvolutionNode

A representation of a convolution kernel.

MPSCNNConvolutionTransposeNode

A representation of a transposed convolution.

MPSCNNConvolutionGradientNode

A representation of a gradient convolution kernel.

MPSCNNConvolutionGradientStateNode

A representation of a gradient convolution state.

MPSCNNCrossChannelNormalizationGradientNode

A representation of a gradient normalization kernel applied across feature channels.

Pooling Layer Nodes

MPSCNNPoolingAverageNode

A representation of an average pooling filter.

MPSCNNDilatedPoolingMaxNode

A representation of a dilated max pooling filter.

MPSCNNPoolingL2NormNode

A representation of a L2-norm pooling filter.

MPSCNNPoolingMaxNode

A representation of a max pooling filter.

MPSCNNPoolingNode

A representation of a MPS CNN pooling kernel.

MPSCNNDilatedPoolingMaxGradientNode

A representation of a gradient dilated max pooling filter.

MPSCNNPoolingAverageGradientNode

A representation of a gradient average pooling filter.

MPSCNNPoolingGradientNode

A representation of a gradient pooling kernel.

MPSCNNPoolingL2NormGradientNode

A representation of a gradient L2-norm pooling filter.

MPSCNNPoolingMaxGradientNode

A representation of a gradient max pooling filter.

Fully Connected Layer Nodes

MPSCNNBinaryFullyConnectedNode

A representation of a fully connected convolution layer with binary weights and optionally binarized input image.

MPSCNNFullyConnectedNode

A representation of a fully connected convolution layer, also known as an inner product layer.

Neuron Layer Nodes

MPSCNNNeuronAbsoluteNode

A representation of an absolute neuron filter.

MPSCNNNeuronELUNode

A representation of a parametric ELU neuron filter.

MPSCNNNeuronHardSigmoidNode

A representation of a hard sigmoid neuron filter.

MPSCNNNeuronLinearNode

A representation of a linear neuron filter.

MPSCNNNeuronPReLUNode

A representation a PReLU neuron filter.

MPSCNNNeuronReLUNNode

A representation a ReLUN neuron filter.

MPSCNNNeuronReLUNode

A representation a ReLU neuron filter.

MPSCNNNeuronSigmoidNode

A representation of a sigmoid neuron filter.

MPSCNNNeuronSoftPlusNode

A representation of a parametric softplus neuron filter.

MPSCNNNeuronSoftSignNode

A representation of a softsign neuron filter.

MPSCNNNeuronTanHNode

A representation of a hyperbolic tangent neuron filter.

MPSCNNNeuronExponentialNode

A representation of an exponential neuron filter.

MPSCNNNeuronGradientNode

A representation of a gradient exponential neuron filter.

MPSCNNNeuronLogarithmNode

A representation of a logarithm neuron filter.

MPSCNNNeuronPowerNode

A representation of a power neuron filter.

MPSCNNNeuronNode

The virtual base class for MPS CNN neuron nodes.

Softmax Layer Nodes

MPSCNNSoftMaxNode

A representation of a softmax filter.

MPSCNNLogSoftMaxNode

A representation of a logarithmic softmax filter kernel.

MPSCNNLogSoftMaxGradientNode

A representation of a gradient logarithmic softmax filter kernel.

MPSCNNSoftMaxGradientNode

A representation of a gradient softmax filter.

Normalization Layer Nodes

MPSCNNCrossChannelNormalizationNode

A representation of a normalization kernel across feature channels.

MPSCNNLocalContrastNormalizationNode

A representation of a local-contrast normalization kernel.

MPSCNNSpatialNormalizationNode

A representation of a spatial normalization kernel.

MPSCNNBatchNormalizationGradientNode

A representation of a gradient batch normalization kernel.

MPSCNNBatchNormalizationNode

A representation of a batch normalization kernel.

MPSCNNBatchNormalizationDataSource

A protocol that defines methods that a batch normalization state uses to initialize scale factors, bias terms, and batch statistics.

MPSCNNInstanceNormalizationGradientNode

A representation of a gradient instance normalization kernel.

MPSCNNInstanceNormalizationDataSource

A protocol that defines methods that an instance normalization uses to initialize scale factors and bias terms.

MPSCNNInstanceNormalizationNode

A representation of an instance normalization kernel.

MPSCNNLocalContrastNormalizationGradientNode

A representation of a gradient local-contrast normalization kernel.

MPSCNNSpatialNormalizationGradientNode

A representation of a gradient spatial normalization kernel.

MPSCNNNormalizationNode

Virtual base class for CNN normalization nodes.

Upsampling Layer Nodes

MPSCNNUpsamplingBilinearNode

A representation of a bilinear spatial upsampling filter.

MPSCNNUpsamplingNearestNode

A representation of a nearest spatial upsampling filter.

MPSCNNUpsamplingBilinearGradientNode

A representation of a gradient bilinear spatial upsampling filter.

MPSCNNUpsamplingNearestGradientNode

A representation of a gradient nearest spatial upsampling filter.

Resampling Nodes

MPSNNBilinearScaleNode

A representation of a bilinear resampling filter.

MPSNNLanczosScaleNode

A representation of a Lanczos resampling filter.

MPSNNScaleNode

Abstract node representing an image resampling filter.

MPSImageTransformProvider

A general interface for objects that provide image resampling.

Dropout Layer Nodes

MPSCNNDropoutNode

A representation of a dropout filter.

MPSCNNDropoutGradientNode

A representation of a gradient dropout filter.

Kernel Concatenation Nodes

MPSNNConcatenationNode

A representation of the results from one or more kernels.

MPSNNConcatenationGradientNode

A representation of the results from one or more gradient kernels.

Loss Layer Nodes

MPSCNNLossNode

A representation of a loss kernel.

MPSCNNYOLOLossNode

A representation of a YOLO loss kernel.

MPSNNLabelsNode

A placeholder node denoting the per-element weight buffer used by loss and gradient loss kernels.

Filter Node Base Classes

MPSNNFilterNode

A placeholder node denoting a neural network filter stage.

MPSNNGradientFilterNode

A representation of a gradient filter.

Protocols

MPSNNTrainableNode

A protocol that defines methods that determine whether and when neural network training parameters are updated.

See Also

Neural Networks

Training a Neural Network with Metal Performance Shaders

Use an MPS neural network graph to train a simple neural network digit classifier.

MPSImage

A texture that may have more than four channels for use in convolutional neural networks.

MPSTemporaryImage

A texture for use in convolutional neural networks that stores transient data to be used and discarded promptly.

Convolutional Neural Network Kernels

Build neural networks with layers.

Recurrent Neural Networks

Create recurrent neural networks.