.TH "MPSMatrixSoftMaxGradient" 3 "Mon Jul 9 2018" "Version MetalPerformanceShaders-119.3" "MetalPerformanceShaders.framework" \" -*- nroff -*- .ad l .nh .SH NAME MPSMatrixSoftMaxGradient .SH SYNOPSIS .br .PP .PP \fC#import \fP .PP Inherits \fBMPSMatrixBinaryKernel\fP\&. .PP Inherited by \fBMPSMatrixLogSoftMaxGradient\fP\&. .SS "Instance Methods" .in +1c .ti -1c .RI "(nonnull instancetype) \- \fBinitWithDevice:\fP" .br .ti -1c .RI "(void) \- \fBencodeToCommandBuffer:gradientMatrix:forwardOutputMatrix:resultMatrix:\fP" .br .ti -1c .RI "(nullable instancetype) \- \fBinitWithCoder:device:\fP" .br .ti -1c .RI "(nonnull instancetype) \- \fBcopyWithZone:device:\fP" .br .in -1c .SS "Properties" .in +1c .ti -1c .RI "NSUInteger \fBsourceRows\fP" .br .ti -1c .RI "NSUInteger \fBsourceColumns\fP" .br .in -1c .SS "Additional Inherited Members" .SH "Detailed Description" .PP This depends on Metal\&.framework\&. .PP Computes the gradient corresponding to a forward \fBMPSMatrixSoftMax\fP object\&. .PP \fBA\fP \fBMPSMatrixSoftMaxGradient\fP object computes: .PP .nf 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. .fi .PP .SH "Method Documentation" .PP .SS "\- (nonnull instancetype) copyWithZone: (nullable NSZone *) zone(nullable id< MTLDevice >) device" Make a copy of this kernel for a new device - .PP \fBSee also:\fP .RS 4 \fBMPSKernel\fP .RE .PP \fBParameters:\fP .RS 4 \fIzone\fP The NSZone in which to allocate the object .br \fIdevice\fP The device for the new \fBMPSKernel\fP\&. If nil, then use self\&.device\&. .RE .PP \fBReturns:\fP .RS 4 a pointer to a copy of this \fBMPSKernel\fP\&. This will fail, returning nil if the device is not supported\&. Devices must be MTLFeatureSet_iOS_GPUFamily2_v1 or later\&. .RE .PP .PP Reimplemented from \fBMPSKernel\fP\&. .SS "\- (void) encodeToCommandBuffer: (nonnull id< MTLCommandBuffer >) commandBuffer(\fBMPSMatrix\fP *__nonnull) gradientMatrix(\fBMPSMatrix\fP *__nonnull) forwardOutputMatrix(\fBMPSMatrix\fP *__nonnull) resultMatrix" Encode a \fBMPSMatrixSoftMaxGradient\fP object to a command buffer\&. .PP \fBParameters:\fP .RS 4 \fIcommandBuffer\fP \fBA\fP valid MTLCommandBuffer to receive the encoded kernel\&. .br \fIgradientMatrix\fP \fBA\fP \fBMPSMatrix\fP object containing gradient values with respect to the forward operation's output\&. dL_dY in the class description\&. .br \fIforwardOutputMatrix\fP \fBA\fP \fBMPSMatrix\fP object containing the output values from the forward operation\&. Y in the class description\&. .br \fIresultMatrix\fP The \fBMPSMatrix\fP object to hold the resulting gradient values with respect to the forward operation's input\&. dL_dX in the class description\&. .RE .PP .SS "\- (nullable instancetype) \fBinitWithCoder:\fP (NSCoder *__nonnull) aDecoder(nonnull id< MTLDevice >) device" \fBNSSecureCoding\fP compatability See \fBMPSKernel::initWithCoder\fP\&. .PP \fBParameters:\fP .RS 4 \fIaDecoder\fP The NSCoder subclass with your serialized \fBMPSMatrixSoftMaxGradient\fP .br \fIdevice\fP The MTLDevice on which to make the \fBMPSMatrixSoftMaxGradient\fP .RE .PP \fBReturns:\fP .RS 4 \fBA\fP new \fBMPSMatrixSoftMaxGradient\fP object, or nil if failure\&. .RE .PP .PP Reimplemented from \fBMPSKernel\fP\&. .SS "\- (nonnull instancetype) initWithDevice: (nonnull id< MTLDevice >) device" Initialize an \fBMPSMatrixSoftMaxGradient\fP object on a device\&. .PP \fBParameters:\fP .RS 4 \fIdevice\fP The device on which the kernel will execute\&. .RE .PP \fBReturns:\fP .RS 4 \fBA\fP valid \fBMPSMatrixSoftMaxGradient\fP object or nil, if failure\&. .RE .PP .PP Reimplemented from \fBMPSKernel\fP\&. .SH "Property Documentation" .PP .SS "\- sourceColumns\fC [read]\fP, \fC [write]\fP, \fC [nonatomic]\fP, \fC [assign]\fP" 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 \fBMPSMatrixBinaryKernel\fP can be used to control the starting points in the primary source, secondary source, and result matrices respectively\&. .SS "\- sourceRows\fC [read]\fP, \fC [write]\fP, \fC [nonatomic]\fP, \fC [assign]\fP" 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 \fBMPSMatrixBinaryKernel\fP can be used to control the starting points in the primary source, secondary source, and result matrices respectively\&. .SH "Author" .PP Generated automatically by Doxygen for MetalPerformanceShaders\&.framework from the source code\&.