MPSMatrixFullyConnectedGradient(3) MetalPerformanceShaders.framework MPSMatrixFullyConnectedGradient(3)

MPSMatrixFullyConnectedGradient

#import <MPSMatrixFullyConnected.h>

Inherits MPSMatrixBinaryKernel.


(nonnull instancetype) - initWithDevice:
(void) - encodeGradientForDataToCommandBuffer:gradientMatrix:weightMatrix:resultGradientForDataMatrix:
(void) - encodeGradientForWeightsAndBiasToCommandBuffer:gradientMatrix:inputMatrix:resultGradientForWeightMatrix:resultGradientForBiasVector:
(nullable instancetype) - initWithCoder:device:
(nonnull instancetype) - copyWithZone:device:


NSUInteger sourceNumberOfFeatureVectors
NSUInteger sourceOutputFeatureChannels
NSUInteger sourceInputFeatureChannels
double alpha

This depends on Metal.framework.

Computes the gradient of the fully connected layer with respect to either the weights and bias terms or the input feature vectors.

An MPSMatrixFullyConnectedGradient kernel may be used to compute the gradients corresponding to a MPSMatrixFullyConnected kernel. The properties, input, and weight data must match those values used in the forward computation. This kernel does not compute the gradient of any non-identity activation function which may have been applied in the forward kernel. Such a kernel must be expressed using both MPSMatrixFullyConnected and MPSMatrixNeuron if a gradient is to be computed.

- (nonnull instancetype) copyWithZone: (nullable NSZone *) zone(nullable id< MTLDevice >) device

Make a copy of this kernel for a new device -

See also:

MPSKernel

Parameters:

zone The NSZone in which to allocate the object
device The device for the new MPSKernel. If nil, then use self.device.

Returns:

A pointer to a copy of this MPSKernel. This will fail, returning nil if the device is not supported. Devices must be MTLFeatureSet_iOS_GPUFamily2_v1 or later.

Reimplemented from MPSKernel.

- (void) encodeGradientForDataToCommandBuffer: (nonnull id< MTLCommandBuffer >) commandBuffer(MPSMatrix const *__nonnull) gradientMatrix(MPSMatrix const *__nonnull) weightMatrix(MPSMatrix *__nonnull) resultGradientForDataMatrix

Encode a MPSMatrixFullyConnectedGradient object to a command buffer and produce the gradient of the loss function with respect to the input data.

Parameters:

commandBuffer A valid MTLCommandBuffer to receive the encoded kernel.
gradientMatrix A valid MPSMatrix object which specifies the input gradient.
weightMatrix A valid MPSMatrix object which specifies the weight array.
resultGradientForDataMatrix A valid MPSMatrix object which specifies the result gradient.

This operation computes the resulting gradient of the loss function with respect to the forward kernel's input data. weightMatrix should contain the same values used to compute the result of the forward kernel.

- (void) encodeGradientForWeightsAndBiasToCommandBuffer: (nonnull id< MTLCommandBuffer >) commandBuffer(MPSMatrix const *__nonnull) gradientMatrix(MPSMatrix const *__nonnull) inputMatrix(MPSMatrix *__nonnull) resultGradientForWeightMatrix(MPSVector *__nullable) resultGradientForBiasVector

Encode a MPSMatrixFullyConnectedGradient object to a command buffer and produce the gradient of the loss function with respect to the weight matrix and bias vector.

Parameters:

commandBuffer A valid MTLCommandBuffer to receive the encoded kernel.
gradientMatrix A valid MPSMatrix object which specifies the input gradient.
inputMatrix A valid MPSMatrix object which specifies the input array.
resultGradientForWeightMatrix A valid MPSMatrix object which specifies the resulting gradients with respect to the weights.
resultGradientForBiasVector A valid MPSVector object which specifies the resulting gradients with respect to the bias terms. If NULL these values will not be returned.

This operation computes the resulting gradient of the loss function with respect to the forward kernel's weight data. inputMatrix should contain the same values used to compute the result of the forward kernel.

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

NSSecureCoding compatability See MPSKernel::initWithCoder.

Parameters:

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

Returns:

A new MPSMatrixFullyConnected 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.

- alpha [read], [write], [nonatomic], [assign]

Scale factor to apply to the product. This value should be equal to the corresponding value in the forward fully connected kernel.

- sourceInputFeatureChannels [read], [write], [nonatomic], [assign]

The number of feature channels in the input to the forward fully connected layer. This is equivalent to the number of columns in the input matrix.

This value should be equal to the corresponding value in the forward fully connected kernel.

- sourceNumberOfFeatureVectors [read], [write], [nonatomic], [assign]

The number of input vectors which make up the input array. This is equivalent to the number of rows in both the input matrix and the source gradient matrix.

This value should be equal to the corresponding value in the forward fully connected kernel.

- sourceOutputFeatureChannels [read], [write], [nonatomic], [assign]

The number of feature channels in the output of the forward fully connected layer. This is equivalent to the number of columns in both the weight matrix and the source gradient matrix.

This value should be equal to the corresponding value in the forward fully connected kernel.

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

Mon Jul 9 2018 Version MetalPerformanceShaders-119.3