<!--
{
  "documentType" : "article",
  "framework" : "MetalPerformanceShaders",
  "identifier" : "/documentation/MetalPerformanceShaders/objects-that-simplify-the-creation-of-neural-networks",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "Objects that Simplify the Creation of Neural Networks"
}
-->

# Objects that Simplify the Creation of Neural Networks

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

## Discussion

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`](/documentation/MetalPerformanceShaders/MPSNNFilterNode), [`MPSNNImageNode`](/documentation/MetalPerformanceShaders/MPSNNImageNode) and [`MPSNNStateNode`](/documentation/MetalPerformanceShaders/MPSNNStateNode) objects.

- [`MPSNNImageNode`](/documentation/MetalPerformanceShaders/MPSNNImageNode) represents [`MPSImage`](/documentation/MetalPerformanceShaders/MPSImage) or [`MPSTemporaryImage`](/documentation/MetalPerformanceShaders/MPSTemporaryImage) objects
- [`MPSNNFilterNode`](/documentation/MetalPerformanceShaders/MPSNNFilterNode) represents [`MPSCNNKernel`](/documentation/MetalPerformanceShaders/MPSCNNKernel) objects—each of the lower level [`MPSCNNKernel`](/documentation/MetalPerformanceShaders/MPSCNNKernel) subclasses has an associated object that is a subclass of the [`MPSNNFilterNode`](/documentation/MetalPerformanceShaders/MPSNNFilterNode)
- [`MPSNNStateNode`](/documentation/MetalPerformanceShaders/MPSNNStateNode) represents [`MPSState`](/documentation/MetalPerformanceShaders/MPSState) objects

## Topics

### Neural Network Graphs

[`MPSNNGraph`](/documentation/MetalPerformanceShaders/MPSNNGraph)

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

[`MPSNNImageNode`](/documentation/MetalPerformanceShaders/MPSNNImageNode)

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

[`MPSHandle`](/documentation/MetalPerformanceShaders/MPSHandle)

The protocol that provides resource identification.

### Arithmetic Layer Nodes

[`MPSNNAdditionNode`](/documentation/MetalPerformanceShaders/MPSNNAdditionNode)

A representation of an addition operator.

[`MPSNNAdditionGradientNode`](/documentation/MetalPerformanceShaders/MPSNNAdditionGradientNode)

A representation of a gradient addition operator.

[`MPSNNSubtractionNode`](/documentation/MetalPerformanceShaders/MPSNNSubtractionNode)

A representation of an subtraction operator.

[`MPSNNSubtractionGradientNode`](/documentation/MetalPerformanceShaders/MPSNNSubtractionGradientNode)

A representation of a gradient subtraction operator.

[`MPSNNMultiplicationNode`](/documentation/MetalPerformanceShaders/MPSNNMultiplicationNode)

A representation of a multiplication operator.

[`MPSNNMultiplicationGradientNode`](/documentation/MetalPerformanceShaders/MPSNNMultiplicationGradientNode)

A representation of a gradient multiplication operator.

[`MPSNNDivisionNode`](/documentation/MetalPerformanceShaders/MPSNNDivisionNode)

A representation of a division operator.

[`MPSNNBinaryArithmeticNode`](/documentation/MetalPerformanceShaders/MPSNNBinaryArithmeticNode)

Virtual base class for basic arithmetic nodes.

[`MPSNNArithmeticGradientNode`](/documentation/MetalPerformanceShaders/MPSNNArithmeticGradientNode)

A representation of the base class for gradient arithmetic operators.

[`MPSNNArithmeticGradientStateNode`](/documentation/MetalPerformanceShaders/MPSNNArithmeticGradientStateNode)

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

### Convolution Layer Nodes

[`MPSCNNBinaryConvolutionNode`](/documentation/MetalPerformanceShaders/MPSCNNBinaryConvolutionNode)

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

[`MPSCNNConvolutionNode`](/documentation/MetalPerformanceShaders/MPSCNNConvolutionNode)

A representation of a convolution kernel.

[`MPSCNNConvolutionTransposeNode`](/documentation/MetalPerformanceShaders/MPSCNNConvolutionTransposeNode)

A representation of a transposed convolution.

[`MPSCNNConvolutionGradientNode`](/documentation/MetalPerformanceShaders/MPSCNNConvolutionGradientNode)

A representation of a gradient convolution kernel.

[`MPSCNNConvolutionGradientStateNode`](/documentation/MetalPerformanceShaders/MPSCNNConvolutionGradientStateNode)

A representation of a gradient convolution state.

[`MPSCNNCrossChannelNormalizationGradientNode`](/documentation/MetalPerformanceShaders/MPSCNNCrossChannelNormalizationGradientNode)

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

### Pooling Layer Nodes

[`MPSCNNPoolingAverageNode`](/documentation/MetalPerformanceShaders/MPSCNNPoolingAverageNode)

A representation of an average pooling filter.

[`MPSCNNDilatedPoolingMaxNode`](/documentation/MetalPerformanceShaders/MPSCNNDilatedPoolingMaxNode)

A representation of a dilated max pooling filter.

[`MPSCNNPoolingL2NormNode`](/documentation/MetalPerformanceShaders/MPSCNNPoolingL2NormNode)

A representation of a L2-norm pooling filter.

[`MPSCNNPoolingMaxNode`](/documentation/MetalPerformanceShaders/MPSCNNPoolingMaxNode)

A representation of a max pooling filter.

[`MPSCNNPoolingNode`](/documentation/MetalPerformanceShaders/MPSCNNPoolingNode)

A representation of a MPS CNN pooling kernel.

[`MPSCNNDilatedPoolingMaxGradientNode`](/documentation/MetalPerformanceShaders/MPSCNNDilatedPoolingMaxGradientNode)

A representation of a gradient dilated max pooling filter.

[`MPSCNNPoolingAverageGradientNode`](/documentation/MetalPerformanceShaders/MPSCNNPoolingAverageGradientNode)

A representation of a gradient average pooling filter.

[`MPSCNNPoolingGradientNode`](/documentation/MetalPerformanceShaders/MPSCNNPoolingGradientNode)

A representation of a gradient pooling kernel.

[`MPSCNNPoolingL2NormGradientNode`](/documentation/MetalPerformanceShaders/MPSCNNPoolingL2NormGradientNode)

A representation of a gradient L2-norm pooling filter.

[`MPSCNNPoolingMaxGradientNode`](/documentation/MetalPerformanceShaders/MPSCNNPoolingMaxGradientNode)

A representation of a gradient max pooling filter.

### Fully Connected Layer Nodes

[`MPSCNNBinaryFullyConnectedNode`](/documentation/MetalPerformanceShaders/MPSCNNBinaryFullyConnectedNode)

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

[`MPSCNNFullyConnectedNode`](/documentation/MetalPerformanceShaders/MPSCNNFullyConnectedNode)

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

### Neuron Layer Nodes

[`MPSCNNNeuronAbsoluteNode`](/documentation/MetalPerformanceShaders/MPSCNNNeuronAbsoluteNode)

A representation of an absolute neuron filter.

[`MPSCNNNeuronELUNode`](/documentation/MetalPerformanceShaders/MPSCNNNeuronELUNode)

A representation of a parametric ELU neuron filter.

[`MPSCNNNeuronHardSigmoidNode`](/documentation/MetalPerformanceShaders/MPSCNNNeuronHardSigmoidNode)

A representation of a hard sigmoid neuron filter.

[`MPSCNNNeuronLinearNode`](/documentation/MetalPerformanceShaders/MPSCNNNeuronLinearNode)

A representation of a linear neuron filter.

[`MPSCNNNeuronPReLUNode`](/documentation/MetalPerformanceShaders/MPSCNNNeuronPReLUNode)

A representation a PReLU neuron filter.

[`MPSCNNNeuronReLUNNode`](/documentation/MetalPerformanceShaders/MPSCNNNeuronReLUNNode)

A representation a ReLUN neuron filter.

[`MPSCNNNeuronReLUNode`](/documentation/MetalPerformanceShaders/MPSCNNNeuronReLUNode)

A representation a ReLU neuron filter.

[`MPSCNNNeuronSigmoidNode`](/documentation/MetalPerformanceShaders/MPSCNNNeuronSigmoidNode)

A representation of a sigmoid neuron filter.

[`MPSCNNNeuronSoftPlusNode`](/documentation/MetalPerformanceShaders/MPSCNNNeuronSoftPlusNode)

A representation of a parametric softplus neuron filter.

[`MPSCNNNeuronSoftSignNode`](/documentation/MetalPerformanceShaders/MPSCNNNeuronSoftSignNode)

A representation of a softsign neuron filter.

[`MPSCNNNeuronTanHNode`](/documentation/MetalPerformanceShaders/MPSCNNNeuronTanHNode)

A representation of a hyperbolic tangent neuron filter.

[`MPSCNNNeuronExponentialNode`](/documentation/MetalPerformanceShaders/MPSCNNNeuronExponentialNode)

A representation of an exponential neuron filter.

[`MPSCNNNeuronGradientNode`](/documentation/MetalPerformanceShaders/MPSCNNNeuronGradientNode)

A representation of a gradient exponential neuron filter.

[`MPSCNNNeuronLogarithmNode`](/documentation/MetalPerformanceShaders/MPSCNNNeuronLogarithmNode)

A representation of a logarithm neuron filter.

[`MPSCNNNeuronPowerNode`](/documentation/MetalPerformanceShaders/MPSCNNNeuronPowerNode)

A representation of a power neuron filter.

[`MPSCNNNeuronNode`](/documentation/MetalPerformanceShaders/MPSCNNNeuronNode)

The virtual base class for MPS CNN neuron nodes.

### Softmax Layer Nodes

[`MPSCNNSoftMaxNode`](/documentation/MetalPerformanceShaders/MPSCNNSoftMaxNode)

A representation of a softmax filter.

[`MPSCNNLogSoftMaxNode`](/documentation/MetalPerformanceShaders/MPSCNNLogSoftMaxNode)

A representation of a logarithmic softmax filter kernel.

[`MPSCNNLogSoftMaxGradientNode`](/documentation/MetalPerformanceShaders/MPSCNNLogSoftMaxGradientNode)

A representation of a gradient logarithmic softmax filter kernel.

[`MPSCNNSoftMaxGradientNode`](/documentation/MetalPerformanceShaders/MPSCNNSoftMaxGradientNode)

A representation of a gradient softmax filter.

### Normalization Layer Nodes

[`MPSCNNCrossChannelNormalizationNode`](/documentation/MetalPerformanceShaders/MPSCNNCrossChannelNormalizationNode)

A representation of a normalization kernel across feature channels.

[`MPSCNNLocalContrastNormalizationNode`](/documentation/MetalPerformanceShaders/MPSCNNLocalContrastNormalizationNode)

A representation of a local-contrast normalization kernel.

[`MPSCNNSpatialNormalizationNode`](/documentation/MetalPerformanceShaders/MPSCNNSpatialNormalizationNode)

A representation of a spatial normalization kernel.

[`MPSCNNBatchNormalizationGradientNode`](/documentation/MetalPerformanceShaders/MPSCNNBatchNormalizationGradientNode)

A representation of a gradient batch normalization kernel.

[`MPSCNNBatchNormalizationNode`](/documentation/MetalPerformanceShaders/MPSCNNBatchNormalizationNode)

A representation of a batch normalization kernel.

[`MPSCNNBatchNormalizationDataSource`](/documentation/MetalPerformanceShaders/MPSCNNBatchNormalizationDataSource)

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

[`MPSCNNInstanceNormalizationGradientNode`](/documentation/MetalPerformanceShaders/MPSCNNInstanceNormalizationGradientNode)

A representation of a gradient instance normalization kernel.

[`MPSCNNInstanceNormalizationDataSource`](/documentation/MetalPerformanceShaders/MPSCNNInstanceNormalizationDataSource)

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

[`MPSCNNInstanceNormalizationNode`](/documentation/MetalPerformanceShaders/MPSCNNInstanceNormalizationNode)

A representation of an instance normalization kernel.

[`MPSCNNLocalContrastNormalizationGradientNode`](/documentation/MetalPerformanceShaders/MPSCNNLocalContrastNormalizationGradientNode)

A representation of a gradient local-contrast normalization kernel.

[`MPSCNNSpatialNormalizationGradientNode`](/documentation/MetalPerformanceShaders/MPSCNNSpatialNormalizationGradientNode)

A representation of a gradient spatial normalization kernel.

[`MPSCNNNormalizationNode`](/documentation/MetalPerformanceShaders/MPSCNNNormalizationNode)

Virtual base class for CNN normalization nodes.

### Upsampling Layer Nodes

[`MPSCNNUpsamplingBilinearNode`](/documentation/MetalPerformanceShaders/MPSCNNUpsamplingBilinearNode)

A representation of a bilinear spatial upsampling filter.

[`MPSCNNUpsamplingNearestNode`](/documentation/MetalPerformanceShaders/MPSCNNUpsamplingNearestNode)

A representation of a nearest spatial upsampling filter.

[`MPSCNNUpsamplingBilinearGradientNode`](/documentation/MetalPerformanceShaders/MPSCNNUpsamplingBilinearGradientNode)

A representation of a gradient bilinear spatial upsampling filter.

[`MPSCNNUpsamplingNearestGradientNode`](/documentation/MetalPerformanceShaders/MPSCNNUpsamplingNearestGradientNode)

A representation of a gradient nearest spatial upsampling filter.

### Resampling Nodes

[`MPSNNBilinearScaleNode`](/documentation/MetalPerformanceShaders/MPSNNBilinearScaleNode)

A representation of a bilinear resampling filter.

[`MPSNNLanczosScaleNode`](/documentation/MetalPerformanceShaders/MPSNNLanczosScaleNode)

A representation of a Lanczos resampling filter.

[`MPSNNScaleNode`](/documentation/MetalPerformanceShaders/MPSNNScaleNode)

Abstract node representing an image resampling filter.

[`MPSImageTransformProvider`](/documentation/MetalPerformanceShaders/MPSImageTransformProvider)

A general interface for objects that provide image resampling.

### Dropout Layer Nodes

[`MPSCNNDropoutNode`](/documentation/MetalPerformanceShaders/MPSCNNDropoutNode)

A representation of a dropout filter.

[`MPSCNNDropoutGradientNode`](/documentation/MetalPerformanceShaders/MPSCNNDropoutGradientNode)

A representation of a gradient dropout filter.

### Kernel Concatenation Nodes

[`MPSNNConcatenationNode`](/documentation/MetalPerformanceShaders/MPSNNConcatenationNode)

A representation of the results from one or more kernels.

[`MPSNNConcatenationGradientNode`](/documentation/MetalPerformanceShaders/MPSNNConcatenationGradientNode)

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

### Loss Layer Nodes

[`MPSCNNLossNode`](/documentation/MetalPerformanceShaders/MPSCNNLossNode)

A representation of a loss kernel.

[`MPSCNNYOLOLossNode`](/documentation/MetalPerformanceShaders/MPSCNNYOLOLossNode)

A representation of a YOLO loss kernel.

[`MPSNNLabelsNode`](/documentation/MetalPerformanceShaders/MPSNNLabelsNode)

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

### Filter Node Base Classes

[`MPSNNFilterNode`](/documentation/MetalPerformanceShaders/MPSNNFilterNode)

A placeholder node denoting a neural network filter stage.

[`MPSNNGradientFilterNode`](/documentation/MetalPerformanceShaders/MPSNNGradientFilterNode)

A representation of a gradient filter.

### Protocols

[`MPSNNTrainableNode`](/documentation/MetalPerformanceShaders/MPSNNTrainableNode)

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



---

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)