MPSMatrixSum(3) MetalPerformanceShaders.framework MPSMatrixSum(3)

MPSMatrixSum

#import <MPSMatrixSum.h>

Inherits MPSKernel.


(nonnull instancetype) - initWithDevice:
(nonnull instancetype) - initWithDevice:count:rows:columns:transpose:
(void) - setNeuronType:parameterA:parameterB:parameterC:
(MPSCNNNeuronType) - neuronType
(void) - encodeToCommandBuffer:sourceMatrices:resultMatrix:scaleVector:offsetVector:biasVector:startIndex:
(nullable instancetype) - initWithCoder:device:


NSUInteger rows
NSUInteger columns
NSUInteger count
BOOL transpose
float neuronParameterA
float neuronParameterB
float neuronParameterC

MPSMatrixSum.h MetalPerformanceShaders.framework

Copyright:

Copyright (c) 2017 Apple Inc. All rights reserved. MetalPerformanceShaders filter base classes

This depends on Metal.framework MPSMatrixSum performs a pointwise summation of N MPSMatrix objects and applies an optional bias term and neuron activation function.

MPSMatrix A = empty matrix; for (i = 0; i < N; ++i) A += alpha[i]*B[i];

if (bias) A += broadcast(bias);

if (neuron) A = applyNeuron(A);

Where B is the array of MPSMatrix objects, A is the destination MPSMatrix, alpha is an array of scalar values, bias is a vector which is broadcast and accumulated across each row of the intermediate result, and applyNeuron is a neuron activation function.

Each matrix in the array may have an independent origin.

- (void) encodeToCommandBuffer: (nonnull id< MTLCommandBuffer >) buffer(NSArray< MPSMatrix * > *__nonnull) sourceMatrices(MPSMatrix *__nonnull) resultMatrix(MPSVector *__nullable) scaleVector(MPSVector *__nullable) offsetVector(MPSVector *__nullable) biasVector(NSUInteger) startIndex

Encode the operations to the command buffer

Parameters:

buffer The command buffer in which to encode the operation.
sourceMatrices A list of matrices from which the matrix data is read.
resultMatrix The result matrix.
scaleVector A MPSVector of type MPSDataTypeFloat32 containing the list of scale factors, specified in single precision.
offsetVector A MPSVector of type MPSDataTypeUInt32 containing the list of offsets, stored as a packed array of MPSMatrixOffset values.
biasVector A MPSVector containing the bias terms to add to the result prior to applying the neuron function, if any. May be nil.
startIndex The starting index into the scale and offset vectors.

- (nullable instancetype) initWithCoder: (NSCoder *__nonnull) aDecoder(nonnull id< MTLDevice >) device

NSSecureCoding compatability See MPSKernel::initWithCoder.

Parameters:

aDecoder The NSCoder subclass with your serialized MPSMatrixSum kernel.
device The MTLDevice on which to make the MPSMatrixSum object.

Returns:

A new MPSMatrixSum object, or nil if failure.

Reimplemented from MPSKernel.

- (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 MPSKernel.

- (nonnull instancetype) initWithDevice: (nonnull id< MTLDevice >) device(NSUInteger) count(NSUInteger) rows(NSUInteger) columns(BOOL) transpose

Initialize a MPSMatrixSum kernel.

Parameters:

device The device on which to initialize the kernel.
count The number of matrices to be summed.
rows The number of rows to use in the input matrices.
columns The number of columns to use in the input matrices.
transpose If YES the result of the summation is to be transposed prior to applying the bias and activation.

- (MPSCNNNeuronType) neuronType

Getter funtion for neuronType set using setNeuronType:parameterA:parameterB:parameterC method

- (void) setNeuronType: (MPSCNNNeuronType) neuronType(float) parameterA(float) parameterB(float) parameterC

Specifies a neuron activation function to be used.

This method can be used to add a neuron activation funtion of given type with associated scalar parameters A, B, and C that are shared across all output values. Note that this method can only be used to specify neurons which are specified by three (or fewer) parameters shared across all output values (or channels, in CNN nomenclature). It is an error to call this method for neuron activation functions like MPSCNNNeuronTypePReLU, which require per-channel parameter values. An MPSMatrixSum kernel is initialized with a default neuron function of MPSCNNNeuronTypeNone.

Parameters:

neuronType Type of neuron activation function. For full list see MPSCNNNeuronType.h
parameterA parameterA of neuron activation that is shared across all output values.
parameterB parameterB of neuron activation that is shared across all output values.
parameterC parameterC of neuron activation that is shared across all output values.

- (NSUInteger) columns [read], [nonatomic], [assign]

The number of columns to sum.

- (NSUInteger) count [read], [nonatomic], [assign]

The number of matrices to sum.

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

Neuron parameter A.

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

Neuron parameter B.

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

Neuron parameter C.

- (NSUInteger) rows [read], [nonatomic], [assign]

The number of rows to sum.

- (BOOL) transpose [read], [nonatomic], [assign]

The transposition used to initialize the kernel.

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

Mon Jul 9 2018 Version MetalPerformanceShaders-119.3