MPSCNNNeuron(3)

NAME
MPSCNNNeuron

SYNOPSIS

#import <MPSCNNNeuron.h>

Inherits MPSCNNKernel.

Inherited by MPSCNNNeuronAbsolute, MPSCNNNeuronELU, MPSCNNNeuronExponential, MPSCNNNeuronHardSigmoid, MPSCNNNeuronLinear, MPSCNNNeuronLogarithm, MPSCNNNeuronPower, MPSCNNNeuronPReLU, MPSCNNNeuronReLU, MPSCNNNeuronReLUN, MPSCNNNeuronSigmoid, MPSCNNNeuronSoftPlus, MPSCNNNeuronSoftSign, and MPSCNNNeuronTanH.

  Instance Methods
(nonnull instancetype) - initWithDevice:
(nonnull instancetype) - initWithDevice:neuronDescriptor:
(nullable instancetype) - initWithCoder:device:

  Properties
MPSCNNNeuronType neuronType
MPSCNNNeuronType float a
float b
float c
NSData * data

  Additional Inherited Members

Detailed Description

This depends on Metal.framework This filter applies a neuron activation function. You must use one of the sub-classes of MPSCNNNeuron.

The following filter types are supported: MPSCNNNeuronTypeNone ///< f(x) = x MPSCNNNeuronTypeLinear ///< f(x) = a * x + b MPSCNNNeuronTypeReLU ///< f(x) = x >= 0 ? x : a * x MPSCNNNeuronTypeSigmoid ///< f(x) = 1 / (1 + e^-x) MPSCNNNeuronTypeHardSigmoid ///< f(x) = clamp((x * a) + b, 0, 1) MPSCNNNeuronTypeTanH ///< f(x) = a * tanh(b * x) MPSCNNNeuronTypeAbsolute ///< f(x) = fabs(x) MPSCNNNeuronTypeSoftPlus ///< f(x) = a * log(1 + e^(b * x)) MPSCNNNeuronTypeSoftSign ///< f(x) = x / (1 + abs(x)) MPSCNNNeuronTypeELU ///< f(x) = x >= 0 ? x : a * (exp(x) - 1) MPSCNNNeuronTypePReLU ///< Same as ReLU except parameter a is per channel MPSCNNNeuronTypeReLUN ///< f(x) = min((x >= 0 ? x : a * x), b) MPSCNNNeuronTypePower ///< f(x) = (a * x + b) ^ c MPSCNNNeuronTypeExponential ///< f(x) = c ^ (a * x + b) MPSCNNNeuronTypeLogarithm ///< f(x) = log_c(a * x + b)

Method Documentation

  - (nullable instancetype) initWithCoder: (NSCoder *__nonnull) aDecoder(nonnull id< MTLDevice >) device
NSSecureCoding compatability While the standard NSSecureCoding/NSCoding method -initWithCoder: should work, since the file can't know which device your data is allocated on, we have to guess and may guess incorrectly. To avoid that problem, use initWithCoder:device instead.

Parameters:
    aDecoder The NSCoder subclass with your serialized MPSKernel
    device The MTLDevice on which to make the MPSKernel

Returns:
    A new MPSKernel object, or nil if failure.

Reimplemented from MPSCNNKernel.

  - (nonnull instancetype) initWithDevice: (nonnull id< MTLDevice >) device
Standard init with default properties per filter type

Parameters:
    device The device that the filter will be used on. May not be NULL.

Returns:
    A pointer to the newly initialized object. This will fail, returning nil if the device is not supported. Devices must be MTLFeatureSet_iOS_GPUFamily2_v1 or later.

Reimplemented from MPSCNNKernel.

Reimplemented in MPSCNNNeuronLinear, MPSCNNNeuronReLU, MPSCNNNeuronPReLU, MPSCNNNeuronSigmoid, MPSCNNNeuronHardSigmoid, MPSCNNNeuronTanH, MPSCNNNeuronAbsolute, MPSCNNNeuronSoftPlus, MPSCNNNeuronSoftSign, MPSCNNNeuronELU, MPSCNNNeuronReLUN, MPSCNNNeuronPower, MPSCNNNeuronExponential, and MPSCNNNeuronLogarithm.

  - (nonnull instancetype) initWithDevice: (nonnull id< MTLDevice >) device(MPSNNNeuronDescriptor *_Nonnull) neuronDescriptor
Initialize the neuron filter with a neuron descriptor.

Parameters:
    device The device the filter will run on.
    neuronDescriptor The neuron descriptor. For the neuron of type MPSCNNNeuronTypePReLU, the neuron descriptor references an NSData object containing a float array with the per feature channel value of PReLu parameter and, in this case, the MPSCNNNeuron retains the NSData object.

Returns:
    A valid MPSCNNNeuron object or nil, if failure.

Property Documentation

  - (MPSCNNNeuronType float) a [read], [nonatomic], [assign]

  - (float) b [read], [nonatomic], [assign]

  - (float) c [read], [nonatomic], [assign]

  - (NSData*) data [read], [nonatomic], [retain]

  - (MPSCNNNeuronType) neuronType [read], [nonatomic], [assign]

Author

Generated automatically by Doxygen for MetalPerformanceShaders.framework from the source code.