MPSNNOptimizerRMSProp(3) MetalPerformanceShaders.framework MPSNNOptimizerRMSProp(3)

MPSNNOptimizerRMSProp

#import <MPSNNOptimizers.h>

Inherits MPSNNOptimizer.


(nonnull instancetype) - initWithDevice:
(nonnull instancetype) - initWithDevice:learningRate:
(nonnull instancetype) - initWithDevice:decay:epsilon:optimizerDescriptor:
(void) - encodeToCommandBuffer:inputGradientVector:inputValuesVector:inputSumOfSquaresVector:resultValuesVector:
(void) - encodeToCommandBuffer:convolutionGradientState:convolutionSourceState:inputSumOfSquaresVectors:resultState:
(void) - encodeToCommandBuffer:batchNormalizationState:inputSumOfSquaresVectors:resultState:
(void) - encodeToCommandBuffer:batchNormalizationGradientState:batchNormalizationSourceState:inputSumOfSquaresVectors:resultState:


double decay
float epsilon

The MPSNNOptimizerRMSProp performs an RMSProp Update RMSProp is also known as root mean square propagation.

s[t] = decay * s[t-1] + (1 - decay) * (g ^ 2) variable = variable - learningRate * g / (sqrt(s[t]) + epsilon)

where, g is gradient of error wrt variable s[t] is weighted sum of squares of gradients

- (void) encodeToCommandBuffer: (__nonnull id< MTLCommandBuffer >) commandBuffer(MPSCNNBatchNormalizationState *__nonnull) batchNormalizationGradientState(MPSCNNBatchNormalizationState *__nonnull) batchNormalizationSourceState(nullable NSArray< MPSVector * > *) inputSumOfSquaresVectors(nonnull MPSCNNNormalizationGammaAndBetaState *) resultState

Encode an MPSNNOptimizerRMSProp object to a command buffer to perform out of place update

Parameters:

commandBuffer A valid MTLCommandBuffer to receive the encoded kernel.
batchNormalizationGradientState A valid MPSCNNBatchNormalizationState object which specifies the input state with gradients for this update.
batchNormalizationSourceState A valid MPSCNNBatchNormalizationState object which specifies the input state with original gamma/beta for this update.
inputSumOfSquaresVectors An array MPSVector object which specifies the gradient sumOfSquares vectors which will be updated and overwritten. The index 0 corresponds to gamma, index 1 corresponds to beta, array can be of size 1 in which case beta won't be updated
resultState A valid MPSCNNNormalizationGammaAndBetaState object which specifies the resultValues state which will be updated and overwritten.

The following operations would be applied


s[t] = decay * s[t-1] + (1 - decay) * (g ^ 2)
variable = variable - learningRate * g / (sqrt(s[t]) + epsilon)
where,
g is gradient of error wrt variable
s[t] is weighted sum of squares of gradients.fi

- (void) encodeToCommandBuffer: (__nonnull id< MTLCommandBuffer >) commandBuffer(MPSCNNBatchNormalizationState *__nonnull) batchNormalizationState(nullable NSArray< MPSVector * > *) inputSumOfSquaresVectors(nonnull MPSCNNNormalizationGammaAndBetaState *) resultState

Encode an MPSNNOptimizerRMSProp object to a command buffer to perform out of place update

Parameters:

commandBuffer A valid MTLCommandBuffer to receive the encoded kernel.
batchNormalizationState A valid MPSCNNBatchNormalizationState object which specifies the input state with gradients and original gamma/beta for this update.
inputSumOfSquaresVectors An array MPSVector object which specifies the gradient sumOfSquares vectors which will be updated and overwritten. The index 0 corresponds to gamma, index 1 corresponds to beta, array can be of size 1 in which case beta won't be updated
resultState A valid MPSCNNNormalizationGammaAndBetaState object which specifies the resultValues state which will be updated and overwritten.

The following operations would be applied


s[t] = decay * s[t-1] + (1 - decay) * (g ^ 2)
variable = variable - learningRate * g / (sqrt(s[t]) + epsilon)
where,
g is gradient of error wrt variable
s[t] is weighted sum of squares of gradients.fi

- (void) encodeToCommandBuffer: (__nonnull id< MTLCommandBuffer >) commandBuffer(MPSCNNConvolutionGradientState *__nonnull) convolutionGradientState(MPSCNNConvolutionWeightsAndBiasesState *__nonnull) convolutionSourceState(nullable NSArray< MPSVector * > *) inputSumOfSquaresVectors(nonnull MPSCNNConvolutionWeightsAndBiasesState *) resultState

Encode an MPSNNOptimizerRMSProp object to a command buffer to perform out of place update

Parameters:

commandBuffer A valid MTLCommandBuffer to receive the encoded kernel.
convolutionGradientState A valid MPSCNNConvolutionGradientState object which specifies the input state with gradients for this update.
convolutionSourceState A valid MPSCNNConvolutionWeightsAndBiasesState object which specifies the input state with values to be updated.
inputSumOfSquaresVectors An array MPSVector object which specifies the gradient sumOfSquares vectors which will be updated and overwritten. The index 0 corresponds to weights, index 1 corresponds to biases, array can be of size 1 in which case biases won't be updated
resultState A valid MPSCNNConvolutionWeightsAndBiasesState object which specifies the resultValues state which will be updated and overwritten.

The following operations would be applied


s[t] = decay * s[t-1] + (1 - decay) * (g ^ 2)
variable = variable - learningRate * g / (sqrt(s[t]) + epsilon)
where,
g is gradient of error wrt variable
s[t] is weighted sum of squares of gradients.fi

- (void) encodeToCommandBuffer: (nonnull id< MTLCommandBuffer >) commandBuffer(nonnull MPSVector *) inputGradientVector(nonnull MPSVector *) inputValuesVector(nonnull MPSVector *) inputSumOfSquaresVector(nonnull MPSVector *) resultValuesVector

Encode an MPSNNOptimizerRMSProp object to a command buffer to perform out of place update

Parameters:

commandBuffer A valid MTLCommandBuffer to receive the encoded kernel.
inputGradientVector A valid MPSVector object which specifies the input vector of gradients for this update.
inputValuesVector A valid MPSVector object which specifies the input vector of values to be updated.
inputSumOfSquaresVector A valid MPSVector object which specifies the gradient velocity vector which will be updated and overwritten.
resultValuesVector A valid MPSVector object which specifies the resultValues vector which will be updated and overwritten.

The following operations would be applied


s[t] = decay * s[t-1] + (1 - decay) * (g ^ 2)
variable = variable - learningRate * g / (sqrt(s[t]) + epsilon)
where,
g is gradient of error wrt variable
s[t] is weighted sum of squares of gradients.fi

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

Standard init with default properties per filter type

Parameters:

device The device that the filter will be used on. May not be NULL.

Returns:

a pointer to the newly initialized object. This will fail, returning nil if the device is not supported. Devices must be MTLFeatureSet_iOS_GPUFamily2_v1 or later.

Reimplemented from MPSNNOptimizer.

- (nonnull instancetype) initWithDevice: (nonnull id< MTLDevice >) device(double) decay(float) epsilon(nonnull MPSNNOptimizerDescriptor *) optimizerDescriptor

Full initialization for the rmsProp update

Parameters:

device The device on which the kernel will execute.
decay The decay to update sumOfSquares
epsilon The epsilon which will be applied
optimizerDescriptor The optimizerDescriptor which will have a bunch of properties to be applied

Returns:

A valid MPSNNOptimizerRMSProp object or nil, if failure.

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

Convenience initialization for the RMSProp update

Parameters:

device The device on which the kernel will execute.
learningRate The learningRate which will be applied

Returns:

A valid MPSNNOptimizerRMSProp object or nil, if failure.

- decay [read], [nonatomic], [assign]

The decay at which we update sumOfSquares Default value is 0.9

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

The epsilon at which we update values This value is usually used to ensure to avoid divide by 0, default value is 1e-8

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

Mon Jul 9 2018 Version MetalPerformanceShaders-119.3