iosswiftconv-neural-networkmetal-performance-shaders

MPSCNNConvolutionDescriptor neuronFilter deprecated


In iOS 11.0 the neuronFilter was deprecated from some ConvolutionDespriptors.

I am still using this, but Xcode already complains about deprecation and this is due to the last argument:

  let desc = MPSCNNConvolutionDescriptor(kernelWidth: kernel.0,
                                     kernelHeight: kernel.1,
                                     inputFeatureChannels: inChannels,
                                     outputFeatureChannels: outChannels,
                                     neuronFilter: activation)

Unfortunately the current Apple docs say nothing about how to solve the issue. The "neuronFilter" arguments needs to be removed from the call, but how do I employ it then ?

Any suggestions ?


Solution

  • "You must implement now the convolution family" Anyhow neuronType, neuronParameterA and neuronParameterB...

    The process has changed but not that much, I think you would do it without too much trouble.

    And yes, neuronFilter is fully deprecated.

    enter image description here

    This is the new way to go:

    Declaration

    class MPSCNNConvolutionDescriptor : NSObject
    

    Overview

    You use an MPSCNNConvolutionDescriptor object to describe the properties of an MPSCNNConvolution kernel such as its size, pixel format and CPU cache mode.

    Don't use a MPSCNNNeuron (neuronFilter) use a MPSCNNKernel instead.

    You have a nice day!