mpscnnbatchnormalizationstate(3) [mojave man page]
MPSCNNBatchNormalizationState(3) MetalPerformanceShaders.framework MPSCNNBatchNormalizationState(3)NAME
MPSCNNBatchNormalizationState
SYNOPSIS
#import <MPSCNNBatchNormalization.h>
Inherits MPSState.
Instance Methods
(nonnull instancetype) - initWithResource:
(void) - reset
(nullable id< MTLBuffer >) - mean
(nullable id< MTLBuffer >) - variance
(nullable id< MTLBuffer >) - gradientForGamma
(nullable id< MTLBuffer >) - gradientForBeta
Class Methods
(nonnull instancetype) + temporaryStateWithCommandBuffer:bufferSize:
(__nonnull instancetype) + temporaryStateWithCommandBuffer:textureDescriptor:
Properties
MPSCNNBatchNormalization * batchNormalization
MPSCNNNormalizationGammaAndBetaState * gammaAndBetaState
Detailed Description
MPSCNNBatchNormalizationState encapsulates the data necessary to execute batch normalization.
MPSCNNBatchNormalizationState cannot initialize the size of its own underlying resources. Use [MPSCNNBatchNormalizationStatistics
resultStateForSourceImages:] or [MPSCNNBatchNormalizationStatistics temporaryResultStateForCommandBuffer:sourceImages:].
Method Documentation
- (nullable id<MTLBuffer>) gradientForBeta
Return an MTLBuffer object containing the values of the gradient of the loss function with respect to the bias terms. If a
MPSCNNBatchNormalizationGradient kernel has not successfully generated these values nil will be returned.
- (nullable id<MTLBuffer>) gradientForGamma
Return an MTLBuffer object containing the values of the gradient of the loss function with respect to the scale factors. If a
MPSCNNBatchNormalizationGradient kernel has not successfully generated these values nil will be returned.
- (nonnull instancetype) initWithResource: (__nullable id< MTLResource >) resource
Unavailable. Use MPSCNNBatchNormalizationStatistics methods to initialize the state object.
Reimplemented from MPSState.
- (nullable id<MTLBuffer>) mean
Return an MTLBuffer object with the most recently computed batch mean values.
- (void) reset
Reset any accumulated state data to its initial values.
+ (nonnull instancetype) temporaryStateWithCommandBuffer: (__nonnull id< MTLCommandBuffer >) cmdBuf(size_t) bufferSize
Unavailable. Use MPSCNNBatchNormalizationStatistics methods to create the temporary state object.
Reimplemented from MPSState.
+ (__nonnull instancetype) temporaryStateWithCommandBuffer: (__nonnull id< MTLCommandBuffer >) cmdBuf(MTLTextureDescriptor *__nonnull)
descriptor
Create a MPSState holding a temporary MTLTexture
Parameters:
cmdBuf The command buffer against which the temporary resource is allocated
descriptor A descriptor for the new temporary texture
Reimplemented from MPSState.
- (nullable id<MTLBuffer>) variance
Return an MTLBuffer object with the most recently computed batch variance values.
Property Documentation
- (MPSCNNBatchNormalization*) batchNormalization [read], [nonatomic], [retain]
- (MPSCNNNormalizationGammaAndBetaState*) gammaAndBetaState [read], [nonatomic], [retain]
Author
Generated automatically by Doxygen for MetalPerformanceShaders.framework from the source code.
Version MetalPerformanceShaders-100 Thu Feb 8 2018 MPSCNNBatchNormalizationState(3)
Check Out this Related Man Page
MPSCNNInstanceNormalization(3) MetalPerformanceShaders.framework MPSCNNInstanceNormalization(3)NAME
MPSCNNInstanceNormalization
SYNOPSIS
#import <MPSCNNInstanceNormalization.h>
Inherits MPSCNNKernel.
Instance Methods
(nonnull instancetype) - initWithDevice:dataSource:
(nonnull instancetype) - initWithDevice:
(nullable instancetype) - initWithCoder:device:
(void) - reloadDataSource:
(void) - reloadGammaAndBetaWithCommandBuffer:gammaAndBetaState:
(MPSCNNInstanceNormalizationGradientState *__nullable) - resultStateForSourceImage:sourceStates:destinationImage:
Properties
float epsilon
id< MPSCNNInstanceNormalizationDataSource > dataSource
Additional Inherited Members
Detailed Description
This depends on Metal.framework This kernel normalizes each image, on a per-channel basis, to have zero mean and unit variance:
for each image: for each channel: y = (x - mean) * gamma / sqrt(variance + epsilon) + beta;
Method Documentation
- (nullable instancetype) initWithCoder: (NSCoder *__nonnull) aDecoder(nonnull id< MTLDevice >) device
NSSecureCoding compatability While the standard NSSecureCoding/NSCoding method -initWithCoder: should work, since the file can't know
which device your data is allocated on, we have to guess and may guess incorrectly. To avoid that problem, use initWithCoder:device
instead.
Parameters:
aDecoder The NSCoder subclass with your serialized MPSKernel
device The MTLDevice on which to make the MPSKernel
Returns:
A new MPSCNNInstanceNormalization object, or nil if failure.
Reimplemented from MPSCNNKernel.
- (nonnull instancetype) initWithDevice: (nonnull id< MTLDevice >) device
Use initWithDevice:dataSource instead
Reimplemented from MPSCNNKernel.
- (nonnull instancetype) initWithDevice: (nonnull id< MTLDevice >) device(nonnull id< MPSCNNInstanceNormalizationDataSource >) dataSource
Initialize a MPSCNNInstanceNormalization kernel on a device.
Parameters:
dataSource An object conforming to the MPSCNNInstanceNormalizationDataSource protocol which
- (void) reloadDataSource: (__nonnull id< MPSCNNInstanceNormalizationDataSource >) dataSource
Reload data using a data source.
Parameters:
dataSource The data source which will provide the gamma and beta terms to scale and bias the normalized result respectively.
- (void) reloadGammaAndBetaWithCommandBuffer: (__nonnull id< MTLCommandBuffer >) commandBuffer(MPSCNNNormalizationGammaAndBetaState *__nonnull)
gammaAndBetaState
Reload data using new gamma and beta terms contained within an MPSCNNInstanceNormalizationGradientState object.
Parameters:
commandBuffer The command buffer on which to encode the reload.
gammaAndBetaState The state containing the updated weights which are to be reloaded.
- (MPSCNNInstanceNormalizationGradientState * __nullable) resultStateForSourceImage: (MPSImage *__nonnull) sourceImage(NSArray< MPSState * >
*__nullable) sourceStates(MPSImage *__nonnull) destinationImage
Return a MPSCNNInstanceNormalizationGradientState object for the provided source image, source states, and destination image.
Reimplemented from MPSCNNKernel.
Property Documentation
- (id<MPSCNNInstanceNormalizationDataSource>) dataSource [read], [nonatomic], [retain]
The data source that the object was initialized with
- epsilon [read], [write], [nonatomic], [assign]
The epsilon value used to bias the variance when normalizing.
Author
Generated automatically by Doxygen for MetalPerformanceShaders.framework from the source code.
Version MetalPerformanceShaders-100 Thu Feb 8 2018 MPSCNNInstanceNormalization(3)