MPSCNNLossDescriptor(3) MetalPerformanceShaders.framework MPSCNNLossDescriptor(3)

MPSCNNLossDescriptor

#import <MPSCNNLoss.h>

Inherits NSObject, and <NSCopying>.


(nonnull instancetype) - init


(nonnull MPSCNNLossDescriptor *) + cnnLossDescriptorWithType:reductionType:


MPSCNNLossType lossType
MPSCNNReductionType reductionType
float weight
float labelSmoothing
NSUInteger numberOfClasses
float epsilon
float delta

This depends on Metal.framework. The MPSCNNLossDescriptor specifies a loss filter descriptor. The same descriptor can be used to initialize both the MPSCNNLoss and the MPSCNNLossGradient filters.

Make a descriptor for a MPSCNNLoss or MPSCNNLossGradient object.

Parameters:

lossType The type of a loss filter.
reductionType The type of a reduction operation to apply. This argument is ignored in the MPSCNNLossGradient filter.

Returns:

A valid MPSCNNLossDescriptor object or nil, if failure.

- (nonnull instancetype) init

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

The delta parameter. The default value is 1.0f. This parameter is valid only for the loss functions of the following type(s): MPSCNNLossTypeHuber.

Given predictions and labels (ground truth), it is applied in the following way: if (|predictions - labels| <= delta, loss = 0.5f * predictions^2 if (|predictions - labels| > delta, loss = 0.5 * delta^2 + delta * (|predictions - labels| - delta)

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

The epsilon parameter. The default value is 1e-7. This parameter is valid only for the loss functions of the following type(s): MPSCNNLossTypeLog.

Given predictions and labels (ground truth), it is applied in the following way: -(labels * log(predictions + epsilon)) - ((1 - labels) * log(1 - predictions + epsilon))

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

The label smoothing parameter. The default value is 0.0f. This parameter is valid only for the loss functions of the following type(s): MPSCNNLossFunctionTypeSoftmaxCrossEntropy, MPSCNNLossFunctionTypeSigmoidCrossEntropy.

MPSCNNLossFunctionTypeSoftmaxCrossEntropy: given labels (ground truth), it is applied in the following way: labels = labelSmoothing > 0 ? labels * (1 - labelSmoothing) + labelSmoothing / numberOfClasses : labels

MPSCNNLossFunctionTypeSigmoidCrossEntropy: given labels (ground truth), it is applied in the following way: labels = labelSmoothing > 0 ? labels * (1 - labelSmoothing) + 0.5 * labelSmoothing : labels

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

The type of a loss filter. This parameter specifies the type of a loss filter.

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

The number of classes parameter. The default value is 1. This parameter is valid only for the loss functions of the following type(s): MPSCNNLossFunctionTypeSoftmaxCrossEntropy.

Given labels (ground truth), it is applied in the following way: labels = labelSmoothing > 0 ? labels * (1 - labelSmoothing) + labelSmoothing / numberOfClasses : labels

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

The type of a reduction operation performed in the loss filter. This parameter specifies the type of a reduction operation performed in the loss filter.

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

The scale factor to apply to each element of a result. Each element of a result is multiplied by the weight value. The default value is 1.0f.

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

Mon Jul 9 2018 Version MetalPerformanceShaders-119.3