MPSCNNConvolution(3) MetalPerformanceShaders.framework MPSCNNConvolution(3)
NAME
MPSCNNConvolution
SYNOPSIS
#import <MPSCNNConvolution.h>
Inherits MPSCNNKernel.
Inherited by MPSCNNFullyConnected.
Instance Methods
(nonnull instancetype) -
initWithDevice:convolutionDescriptor:kernelWeights:biasTerms:flags:
(nonnull instancetype) - initWithDevice:weights:
(nullable instancetype) - initWithCoder:device:
(nonnull instancetype) - initWithDevice:
(void) - encodeToCommandBuffer:sourceImage:destinationImage:state:
Properties
NSUInteger inputFeatureChannels
NSUInteger outputFeatureChannels
NSUInteger groups
NSUInteger subPixelScaleFactor
NSUInteger dilationRateX
NSUInteger dilationRateY
const MPSCNNNeuron *__nullable neuron
const MPSCNNNeuron *__nullable MPSCNNNeuronType neuronType
float neuronParameterA
float neuronParameterB
NSUInteger channelMultiplier
Additional Inherited Members
Detailed Description
This depends on Metal.framework The MPSCNNConvolution specifies a
convolution. The MPSCNNConvolution convolves the input image with a set
of filters, each producing one feature map in the output image.
Method Documentation
- (void) encodeToCommandBuffer: (nonnull id< MTLCommandBuffer >)
commandBuffer(MPSImage *__nonnull) sourceImage(MPSImage *__nonnull)
destinationImage(__autoreleasing MPSCNNConvolutionState *__nonnull
*__nonnull) outState
Encode a MPSCNNKernel into a command Buffer. The operation shall
proceed out-of-place.
Parameters:
commandBuffer A valid MTLCommandBuffer to receive the encoded
filter
sourceImage A valid MPSImage object containing the source image.
destinationImage A valid MPSImage to be overwritten by result
image. destinationImage may not alias sourceImage.
outState A pointer to recieve a state that is consumed by
MPSCNNConvolutionTranspose.
- (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.
Reimplemented in MPSCNNFullyConnected.
- (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 MPSCNNFullyConnected.
- (nonnull instancetype) initWithDevice: (nonnull id< MTLDevice >)
device(const MPSCNNConvolutionDescriptor *__nonnull)
convolutionDescriptor(const float *__nonnull) kernelWeights(const float
*__nullable) biasTerms(MPSCNNConvolutionFlags) flags
Initializes a convolution kernel
Parameters:
device The MTLDevice on which this MPSCNNConvolution filter will be
used
convolutionDescriptor A pointer to a MPSCNNConvolutionDescriptor.
kernelWeights A pointer to a weights array. Each entry is a float
value. The number of entries is = inputFeatureChannels *
outputFeatureChannels * kernelHeight * kernelWidth The layout of
filter weight is so that it can be reinterpreted as 4D tensor
(array) weight[ outputChannels ][ kernelHeight ][ kernelWidth ][
inputChannels / groups ] Weights are converted to half float (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 =
numberOfOutputFeatureMaps
flags Currently unused. Pass MPSCNNConvolutionFlagsNone
Returns:
A valid MPSCNNConvolution object or nil, if failure.
Reimplemented in MPSCNNFullyConnected.
- (nonnull instancetype) initWithDevice: (nonnull id< MTLDevice >)
device(nonnull id< MPSCNNConvolutionDataSource >) weights
Initializes a convolution kernel
Parameters:
device The MTLDevice on which this MPSCNNConvolution filter will be
used
weights A pointer to a object that conforms to the
MPSCNNConvolutionDataSource protocol. The
MPSCNNConvolutionDataSource protocol declares the methods that an
instance of MPSCNNConvolution uses to obtain the weights and bias
terms for the CNN convolution filter.
Returns:
A valid MPSCNNConvolution object or nil, if failure.
Reimplemented in MPSCNNFullyConnected.
Property Documentation
- (NSUInteger) channelMultiplier [read], [nonatomic], [assign]
Channel multiplier. For convolution created with
MPSCNNDepthWiseConvolutionDescriptor, it is the number of output
feature channels for each input channel. See
MPSCNNDepthWiseConvolutionDescriptor for more details. Default is 0
which means regular CNN convolution.
- dilationRateX [read], [nonatomic], [assign]
Dilation rate which was passed in as part of
MPSCNNConvolutionDescriptor when creating this MPSCNNConvolution
object.
- (NSUInteger) dilationRateY [read], [nonatomic], [assign]
- groups [read], [nonatomic], [assign]
Number of groups input and output channels are divided into.
- inputFeatureChannels [read], [nonatomic], [assign]
The number of feature channels per pixel in the input image.
- neuron [read], [nonatomic], [assign]
MPSCNNNeuron filter to be applied as part of convolution. Can be nil in
wich case no neuron activation fuction is applied.
- (float) neuronParameterA [read], [nonatomic], [assign]
Parameter 'a' for the neuron. Default: 1.0f Please see class
description for interpretation of a.
- (float) neuronParameterB [read], [nonatomic], [assign]
Parameter 'b' for the neuron. Default: 1.0f Please see class
description for interpretation of b.
- (const MPSCNNNeuron* __nullable MPSCNNNeuronType) neuronType [read],
[nonatomic], [assign]
The type of neuron to append to the convolution Please see class
description for a full list. Default is MPSCNNNeuronTypeNone.
- outputFeatureChannels [read], [nonatomic], [assign]
The number of feature channels per pixel in the output image.
- subPixelScaleFactor [read], [nonatomic], [assign]
Sub pixel scale factor which was passed in as part of
MPSCNNConvolutionDescriptor when creating this MPSCNNConvolution
object.
Author
Generated automatically by Doxygen for
MetalPerformanceShaders.framework from the source code.
Version MetalPerformanceShaders-Thu2Jul 13 2017 MPSCNNConvolution(3)
Mac OS X 10.13.1 - Generated Mon Nov 6 16:21:27 CST 2017