MPSMatrixSoftMax(3) | MetalPerformanceShaders.framework | MPSMatrixSoftMax(3) |
MPSMatrixSoftMax
#import <MPSMatrixSoftMax.h>
Inherits MPSMatrixUnaryKernel.
Inherited by MPSMatrixLogSoftMax.
(nonnull instancetype) - initWithDevice:
(void) - encodeToCommandBuffer:inputMatrix:resultMatrix:
(nullable instancetype) - initWithCoder:device:
(nonnull instancetype) - copyWithZone:device:
NSUInteger sourceRows
NSUInteger sourceColumns
This depends on Metal.framework.
A softmax kernel that operates on matrices.
A MPSMatrixSoftMax object computes:
B_ij = Exp { A_ij } / ( Sum_k Exp { A_ik } )
A and B are matrices which are represented by MPSMatrix
objects. This filter computes the same result for MPSMatrices as
MPSCNNSoftMax filter does for MPSImages by interpreting the columns
of the matrix as feature channels, that is the sum runs over column indices.
Make a copy of this kernel for a new device -
See also:
Parameters:
Returns:
Reimplemented from MPSKernel.
Encode a MPSMatrixSoftMax object to a command buffer.
Parameters:
Certain constraints apply to the sizes of the matrices depending on the sizes requested at initialization time as well as the origins at the time this routine is called:
The result matrix must be large enough to hold a two dimensional array of 'sourceRows' rows and 'sourceColumns' columns beginning at resultMatrixOrigin.
Each matrix within the range specified by batchStart and batchSize, which also specifies a valid set of matrices within inputMatrix and resultMatrix, will be processed.
The datatypes of the matrices inputMatrix and resultMatrix must match and be either MPSDataTypeFloat32 or MPSDataTypeFloat16.
NSSecureCoding compatability See MPSKernel::initWithCoder.
Parameters:
Returns:
Reimplemented from MPSKernel.
Initialize an MPSMatrixSoftMax object on a device for a given size.
Parameters:
Returns:
Reimplemented from MPSKernel.
The number of columns to consider from the source 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 matrix available starting from 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: sourceMatrixOrigin and resultMatrixOrigin from MPSMatrixUnaryKernel can be used to control the starting points in the source and destination at kernel encode time (see encodeToCommandBuffer).
The number of rows to consider from the source 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 matrix available starting from 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: sourceMatrixOrigin and resultMatrixOrigin from MPSMatrixUnaryKernel can be used to control the starting points in the source and destination at kernel encode time (see encodeToCommandBuffer).
Generated automatically by Doxygen for MetalPerformanceShaders.framework from the source code.
Mon Jul 9 2018 | Version MetalPerformanceShaders-119.3 |