Protocol

MLCustomLayer

An interface that defines the behavior of a custom layer in your neural network model.

Declaration

@protocol MLCustomLayer

Overview

You use the MLCustomLayer protocol to define the behavior of your own neural network layers in Core ML models. You can deploy novel or proprietary models on your own release schedule. Custom layers also provide a mechanism for pre- or post-processing during model evaluation.

Topics

Creating a Layer

- initWithParameterDictionary:error:

Initializes the custom layer implementation.

Required.

Integrating a Layer

- setWeightData:error:

Assigns the weights for the connections within the layer.

Required.

- outputShapesForInputShapes:error:

Calculates the shapes of the output of this layer for the given input shapes.

Required.

Evaluating a Layer

- evaluateOnCPUWithInputs:outputs:error:

Evaluates the custom layer with the given inputs.

Required.

- encodeToCommandBuffer:inputs:outputs:error:

Encodes GPU commands to evaluate the custom layer.

See Also

Customization

Integrating Custom Layers

Integrate custom neural network layers into your Core ML app.

Creating a Custom Layer

Make your own custom layer for Core ML models.

MLCustomModel

An interface that defines the behavior of a custom model.