Contents

init(device:convolutionDescriptor:kernelWeights:biasTerms:flags:)

Initializes a convolution kernel.

Declaration

init(device: any MTLDevice, convolutionDescriptor: MPSCNNConvolutionDescriptor, kernelWeights: UnsafePointer<Float>, biasTerms: UnsafePointer<Float>?, flags: MPSCNNConvolutionFlags)

Parameters

  • device:

    The device on which this kernel will run.

  • convolutionDescriptor:

    A pointer to a valid convolution descriptor.

  • kernelWeights:

    A pointer to a weights array.

    Each entry is a float value. The number of entries is equal to Inputfeaturechannels * Outputfeaturechannels * Kernelheight * Kernelwidth.

    The layout of the filter weight is arranged so that it can be reinterpreted as a 4D tensor (array) weight[outputChannels][kernelHeight][kernelWidth][inputChannels/groups]

    Weights are converted to half float precision (fp16) internally for best performance.

  • biasTerms:

    A pointer to bias terms to be applied to the convolution output.

    Each entry is a float value. The number of entries is the number of output feature maps.

  • flags:

    Currently unused.

    This value must be None.

Return Value

A valid MPSCNNConvolution object or nil, if failure.

See Also

Initializers