NAME
<MPSCNNInstanceNormalizationDataSource >
SYNOPSIS
#import <MPSCNNInstanceNormalization.h>
Inherits <MPSNNGradientStateNSObject>, and <NSCopying>.
Instance Methods
(float *__nullable) - gamma
(float *__nullable) - beta
(NSString *__nullable) - label
(MPSCNNNormalizationGammaAndBetaState *__nullable) -
updateGammaAndBetaWithCommandBuffer:instanceNormalizationStateBatch:
(BOOL) - updateGammaAndBetaWithInstanceNormalizationStateBatch:
(float) - epsilon
(void) - encodeWithCoder:
(nullable instancetype) - initWithCoder:
(nonnull instancetype) - copyWithZone:device:
Properties
NSUInteger numberOfFeatureChannels
BOOL supportsSecureCoding
Method Documentation
- (float* __nullable MPSCNNInstanceNormalizationDataSource) beta [required]
Return a pointer to an array containing the beta terms.
- (nonnull instancetype MPSCNNInstanceNormalizationDataSource) copyWithZone: (nullable NSZone *) zone(nullable id< MTLDevice >) device
Optional copy method to create a copy of the data source for use with a new device.
Parameters:
device The device where the kernel which uses this data source will be used.
Returns:
- (void MPSCNNInstanceNormalizationDataSource) encodeWithCoder: (NSCoder *__nonnull) aCoder [optional]
Optional NSSecureCoding compatibility.
- (float MPSCNNInstanceNormalizationDataSource) epsilon [optional]
An optional tiny number to use to maintain numerical stability. output_image = (input_image - mean[c]) * gamma[c] / sqrt(variance[c] + epsilon) + beta[c]; Defalt value if method unavailable: FLT_MIN
- (float* __nullable MPSCNNInstanceNormalizationDataSource) gamma [required]
Return a pointer to an array containing the gamma terms.
- (nullable instancetype MPSCNNInstanceNormalizationDataSource) initWithCoder: (NSCoder *__nonnull) aDecoder [optional]
- (NSString* __nullable MPSCNNInstanceNormalizationDataSource) label
A label that is transferred to the instance normalization filter at init time Overridden by a MPSCNNInstanceNormalizationNode.label if it is non-nil.
- (MPSCNNNormalizationGammaAndBetaState * __nullable MPSCNNInstanceNormalizationDataSource) updateGammaAndBetaWithCommandBuffer: (nonnull id< MTLCommandBuffer >) commandBuffer(MPSCNNInstanceNormalizationGradientStateBatch *__nonnull) instanceNormalizationStateBatch [optional]
Compute new gamma and beta values using current values and gradients contained within a MPSCNNInstanceNormalizationStateBatch. This is for use in the context of training a network within a MPSNNGraph. If you are writing your own graph using the low level interface or aren't training instance normalization it isn't needed.
In this mathod, you should perform the update on a GPU, because at the time it is called the data isn't in the state objects yet and the CPU can't do the work. You should not attempt to update the MPSCNNInstanceNormalization kernel directly with the results. The state object returned from the function will be used for that. A batch of states will be passed in. You should accumulate the gradients and then update the weights.
This operation is expected to also decrement the read count of instanceNormalizationStateBatch by 1, if the states are temporary.
Parameters:
instanceNormalizationStateBatch A batch of MPSCNNInstanceNormalizationGradientState objects containing current weights and gradients.
Returns:
- (BOOL MPSCNNInstanceNormalizationDataSource) updateGammaAndBetaWithInstanceNormalizationStateBatch: (MPSCNNInstanceNormalizationGradientStateBatch *__nonnull) instanceNormalizationStateBatch [optional]
Compute new gamma and beta values using current values and gradients contained within a batch MPSCNNInstanceNormalizationState objects. Perform the update on the CPU.
Parameters:
Returns:
Property Documentation
- (NSUInteger MPSCNNInstanceNormalizationDataSource) numberOfFeatureChannels [read], [nonatomic], [assign]
- (BOOL MPSCNNInstanceNormalizationDataSource) supportsSecureCoding [read], [optional], [atomic], [assign]
Author
Generated automatically by Doxygen for MetalPerformanceShaders.framework from the source code.