Integrate custom neural network layers into your Core ML app.
- Core ML
The field of neural networks is constantly evolving, with new architectures and layers rapidly being created to solve new problems. Core ML neural network models can define and use their own custom layers.
Add Third-Party Models with Custom Layers
If you acquire a third-party model that uses custom layers, the Xcode UI for your model will look slightly different than it would for a model with no custom layers. It will show a list of dependencies below the inputs and outputs for the network. The third-party source of your network should provide the implementation of the layer classes to support their network. Add the classes listed in the dependencies to your Xcode project, so that the network can be evaluated properly.
In Figure 1 the model has dependencies on the custom layers
Simple. Make sure that the implementations of all dependencies for your model are included in the project to use the model for predictions.
Create Your Own Custom Layer
If no implementation is available for your custom layer, you can create it yourself. Creating a custom layer requires you to be very familiar with the architecture of your neural network and the intended behavior of your custom layer. See Creating a Custom Layer for details.