<!--
{
  "documentType" : "article",
  "framework" : "MLCompute",
  "identifier" : "/documentation/MLCompute/layers",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "Layers"
}
-->

# Layers

Create and inspect layers that encapsulate operations and configuration details to receive, process, and output tensors.

## Topics

### Activation Layers

[`class MLCActivationLayer`](/documentation/MLCompute/MLCActivationLayer)

A layer that applies an activation function to the source tensor and produces an output.

[`class MLCMultiheadAttentionLayer`](/documentation/MLCompute/MLCMultiheadAttentionLayer)

A multihead, scaled dot-product attention layer that attends to one or more entries in the input key-value pairs.

[`class MLCSoftmaxLayer`](/documentation/MLCompute/MLCSoftmaxLayer)

A layer that outputs a probability distribution as attention weights.

### Math Layers

[`class MLCArithmeticLayer`](/documentation/MLCompute/MLCArithmeticLayer)

A layer that performs an arithmetic operation.

[`class MLCReductionLayer`](/documentation/MLCompute/MLCReductionLayer)

A layer that reduces tensor values across a specific dimension to a scalar value.

[`class MLCMatMulLayer`](/documentation/MLCompute/MLCMatMulLayer)

A layer that multiplies matrices.

[`class MLCFullyConnectedLayer`](/documentation/MLCompute/MLCFullyConnectedLayer)

A layer that connects each input to each output within its layer.

[`class MLCGramMatrixLayer`](/documentation/MLCompute/MLCGramMatrixLayer)

A layer that computes the uncentered cross-correlation values between the spacial planes of each feature channel of a tensor.

[`class MLCComparisonLayer`](/documentation/MLCompute/MLCComparisonLayer)

A layer that performs elementwise comparison of two tensors.

### Transformation Layers

[`class MLCTransposeLayer`](/documentation/MLCompute/MLCTransposeLayer)

A layer that permutes the dimensions you specify.

[`class MLCConcatenationLayer`](/documentation/MLCompute/MLCConcatenationLayer)

A layer that combines tensors into a single tensor.

[`class MLCReshapeLayer`](/documentation/MLCompute/MLCReshapeLayer)

A layer that reshapes a tensor with the shape you specify.

[`class MLCSliceLayer`](/documentation/MLCompute/MLCSliceLayer)

A layer that extracts a slice from a tensor.

[`class MLCSplitLayer`](/documentation/MLCompute/MLCSplitLayer)

A layer that splits a tensor value into a list of subtensors.

[`class MLCPaddingLayer`](/documentation/MLCompute/MLCPaddingLayer)

A layer that pads a tensor with the padding sizes you specify.

[`class MLCScatterLayer`](/documentation/MLCompute/MLCScatterLayer)

A layer that updates the output at an index you specify.

[`class MLCSelectionLayer`](/documentation/MLCompute/MLCSelectionLayer)

A layer for selecting elements from two tensors.

[`class MLCGatherLayer`](/documentation/MLCompute/MLCGatherLayer)

A layer that fetches data at the locations you specify.

### Normalization Layers

[`class MLCLayerNormalizationLayer`](/documentation/MLCompute/MLCLayerNormalizationLayer)

A layer that applies layer normalization over inputs.

[`class MLCBatchNormalizationLayer`](/documentation/MLCompute/MLCBatchNormalizationLayer)

A layer that normalizes a batch of inputs.

[`class MLCGroupNormalizationLayer`](/documentation/MLCompute/MLCGroupNormalizationLayer)

A layer that divides the channels into groups for normalization.

[`class MLCInstanceNormalizationLayer`](/documentation/MLCompute/MLCInstanceNormalizationLayer)

A layer that normalizes all features of one channel.

[`class MLCDropoutLayer`](/documentation/MLCompute/MLCDropoutLayer)

A layer that deactivates neurons randomly to avoid overfitting.

### Convolution and Recurrent Layers

[`class MLCConvolutionLayer`](/documentation/MLCompute/MLCConvolutionLayer)

A layer that applies a convolution over a signal.

[`class MLCLSTMLayer`](/documentation/MLCompute/MLCLSTMLayer)

A layer that represents long short-term memory (LSTM) networks.

[`class MLCPoolingLayer`](/documentation/MLCompute/MLCPoolingLayer)

A layer that summarizes the average presence of a feature.

[`class MLCUpsampleLayer`](/documentation/MLCompute/MLCUpsampleLayer)

A layer that applies upsampling with the shape you specify.

[`class MLCEmbeddingLayer`](/documentation/MLCompute/MLCEmbeddingLayer)

A layer that stores a word embedding.

### Loss Layers

[`class MLCLossLayer`](/documentation/MLCompute/MLCLossLayer)

A layer that estimates the inaccuracies of the model to reduce the loss on the next evaluation.

[`class MLCYOLOLossLayer`](/documentation/MLCompute/MLCYOLOLossLayer)

A layer that estimates loss for the YOLO algorithm.

### Base Layer

[`class MLCLayer`](/documentation/MLCompute/MLCLayer)

The base class for all framework layers.

### Supporting Types

[`enum MLCPaddingPolicy`](/documentation/MLCompute/MLCPaddingPolicy-3hic8)

A padding policy that you specify for a convolution or pooling layer.

[`enum MLCPaddingType`](/documentation/MLCompute/MLCPaddingType)

A padding type that you specify for a padding layer.



---

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)