MPSMatrixSoftMaxGradient(3) MetalPerformanceShaders.framework MPSMatrixSoftMaxGradient(3)

MPSMatrixSoftMaxGradient

#import <MPSMatrixSoftMax.h>

Inherits MPSMatrixBinaryKernel.

Inherited by MPSMatrixLogSoftMaxGradient.


(nonnull instancetype) - initWithDevice:
(void) - encodeToCommandBuffer:gradientMatrix:forwardOutputMatrix:resultMatrix:
(nullable instancetype) - initWithCoder:device:
(nonnull instancetype) - copyWithZone:device:


NSUInteger sourceRows
NSUInteger sourceColumns

This depends on Metal.framework.

Computes the gradient corresponding to a forward MPSMatrixSoftMax object.

A MPSMatrixSoftMaxGradient object computes:


dL_dX_ij = Y_ij * (dL_dY_ij - sum_k(dL_dY_ik * Y_ik)
Where dL_dX is the resulting gradient of the loss function with respect to
the original input to the forward MPSMatrixSoftMax operation, Y is
the output of the forward MPSMatrixSoftMax operation, and dL_dY is the
gradient of the loss function with respect to Y.

- (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) encodeToCommandBuffer: (nonnull id< MTLCommandBuffer >) commandBuffer(MPSMatrix *__nonnull) gradientMatrix(MPSMatrix *__nonnull) forwardOutputMatrix(MPSMatrix *__nonnull) resultMatrix

Encode a MPSMatrixSoftMaxGradient object to a command buffer.

Parameters:

commandBuffer A valid MTLCommandBuffer to receive the encoded kernel.
gradientMatrix A MPSMatrix object containing gradient values with respect to the forward operation's output. dL_dY in the class description.
forwardOutputMatrix A MPSMatrix object containing the output values from the forward operation. Y in the class description.
resultMatrix The MPSMatrix object to hold the resulting gradient values with respect to the forward operation's input. dL_dX in the class description.

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

NSSecureCoding compatability See MPSKernel::initWithCoder.

Parameters:

aDecoder The NSCoder subclass with your serialized MPSMatrixSoftMaxGradient
device The MTLDevice on which to make the MPSMatrixSoftMaxGradient

Returns:

A new MPSMatrixSoftMaxGradient object, or nil if failure.

Reimplemented from MPSKernel.

- (nonnull instancetype) initWithDevice: (nonnull id< MTLDevice >) device

Initialize an MPSMatrixSoftMaxGradient object on a device.

Parameters:

device The device on which the kernel will execute.

Returns:

A valid MPSMatrixSoftMaxGradient object or nil, if failure.

Reimplemented from MPSKernel.

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

The number of columns to consider from the sources in the operation. This property is modifiable and defaults to NSUIntegerMax and the number is adjusted dynamically at kernel encode time (see encodeToCommandBuffer) to fit into the source matrices available starting from [primary/secondary]SourceMatrixOrigin.y, indicating that by default the whole source matrix is used. If a different size is desired then this should be modified prior to encoding the kernel. It is the user's responsibility to ensure that the resultMatrix parameter in encodeToCommandBuffer is large enough to accommodate the results of this operation, otherwise the results of the encode call are undefined. NOTE: primarySourceMatrixOrigin, secondarySourceMatrixOrigin and resultMatrixOrigin from MPSMatrixBinaryKernel can be used to control the starting points in the primary source, secondary source, and result matrices respectively.

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

The number of rows to consider from the sources in the operation. This property is modifiable and defaults to NSUIntegerMax and the number is adjusted dynamically at kernel encode time (see encodeToCommandBuffer) to fit into the source matrices available starting from [primary/secondary]SourceMatrixOrigin.x, indicating that by default the whole source matrix is used. If a different size is desired then this should be modified prior to encoding the kernel. It is the user's responsibility to ensure that the resultMatrix parameter in encodeToCommandBuffer is large enough to accommodate the results of this operation, otherwise the results of the encode call are undefined. NOTE: primarySourceMatrixOrigin, secondarySourceMatrixOrigin and resultMatrixOrigin from MPSMatrixBinaryKernel can be used to control the starting points in the primary source, secondary source, and result matrices respectively.

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

Mon Jul 9 2018 Version MetalPerformanceShaders-119.3