MPSCNNLossLabels(3) MetalPerformanceShaders.framework MPSCNNLossLabels(3)

MPSCNNLossLabels

#import <MPSCNNLoss.h>

Inherits MPSState.


(nonnull instancetype) - init
(nonnull instancetype) - initWithDevice:labelsDescriptor:
(nonnull instancetype) - initWithDevice:lossImageSize:labelsDescriptor:weightsDescriptor:
(nonnull MPSImage *) - lossImage
(nonnull MPSImage *) - labelsImage
(nonnull MPSImage *) - weightsImage

This depends on Metal.framework. The MPSCNNLossLabels is used to hold the per-element weights buffer used by both MPSCNNLoss forward filter and MPSCNNLossGradient backward filter. The MPSCNNLoss forward filter populates the MPSCNNLossLabels object and the MPSCNNLossGradient backward filter consumes the state object.

- (nonnull instancetype) init

Use one of the interfaces below instead.

Reimplemented from MPSState.

- (nonnull instancetype) initWithDevice: (nonnull id< MTLDevice >) device(MPSCNNLossDataDescriptor *_Nonnull) labelsDescriptor

Set labels (aka targets, ground truth) for the MPSCNNLossLabels object. The labels and weights data are copied into internal storage. The computed loss can either be a scalar value (in batch mode, a single value per image in a batch) or it can be one value per feature channel. Thus, the size of the loss image must either match the size of the input source image or be {1, 1, 1}, which results in a scalar value. In this convinience initializer, the assumed size of the loss image is {1, 1, 1}.

Parameters:

device Device the state resources will be created on.
labelsDescriptor Describes the labels data. This includes:
  • The per-element labels data. The data must be in floating point format.
  • Data layout of labels data. See MPSImage.h for more information.
  • Size of labels data: (width, height, feature channels}.
  • Optionally, row bytes of labels data.
  • Optionally, slice bytes of labels data.

- (nonnull instancetype) initWithDevice: (nonnull id< MTLDevice >) device(MTLSize) lossImageSize(MPSCNNLossDataDescriptor *_Nonnull) labelsDescriptor(MPSCNNLossDataDescriptor *_Nullable) weightsDescriptor

Set labels (aka targets, ground truth) and weights for the MPSCNNLossLabels object. Weights are optional. The labels and weights data are copied into internal storage.

Parameters:

device Device the state resources will be created on.
lossImageSize The size of the resulting loss image: { width, height, featureChannels }. The computed loss can either be a scalar value (in batch mode, a single value per image in a batch) or it can be one value per feature channel. Thus, the size of the loss image must either match the size of the input source image or be {1, 1, 1}, which results in a scalar value.
labelsDescriptor Describes the labels data. This includes:
  • The per-element labels data. The data must be in floating point format.
  • Data layout of labels data. See MPSImage.h for more information.
  • Size of labels data: (width, height, feature channels}.
  • Optionally, row bytes of labels data.
  • Optionally, slice bytes of labels data.

weightsDescriptor Describes the weights data. This includes:

  • The per-element weights data. The data must be in floating point format.
  • Data layout of weights data. See MPSImage.h for more information.
  • Size of weights data: (width, height, feature channels}.
  • Optionally, row bytes of weights data.
  • Optionally, slice bytes of weights data. This parameter is optional. If you are using a single weight, please use the weight property of the MPSCNNLossDescriptor object.

- (nonnull MPSImage*) labelsImage

Labels image accessor method.

Returns:

An autoreleased MPSImage object, containing the labels data. The labels data is populated in the -initWithDevice call.

In order to gaurantee that the image is correctly synchronized for CPU side access, it is the application's responsibility to call the [gradientState synchronizeOnCommandBuffer:] method before accessing the data in the image.

- (nonnull MPSImage*) lossImage

Loss image accessor method.

Returns:

An autoreleased MPSImage object, containing the loss data. The loss data is populated in the -encode call, thus the contents are undefined until you -encode the filter.

In order to gaurantee that the image is correctly synchronized for CPU side access, it is the application's responsibility to call the [gradientState synchronizeOnCommandBuffer:] method before accessing the data in the image.

- (nonnull MPSImage*) weightsImage

Weights image accessor method.

Returns:

An autoreleased MPSImage object, containing the weights data. The weights data is populated in the -initWithDevice call.

In order to gaurantee that the image is correctly synchronized for CPU side access, it is the application's responsibility to call the [gradientState synchronizeOnCommandBuffer:] method before accessing the data in the image.

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

Mon Jul 9 2018 Version MetalPerformanceShaders-119.3