Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

mpscnnbatchnormalizationnode(3) [mojave man page]

MPSCNNBatchNormalizationNode(3) 			 MetalPerformanceShaders.framework			   MPSCNNBatchNormalizationNode(3)

NAME
MPSCNNBatchNormalizationNode SYNOPSIS
#import <MPSNNGraphNodes.h> Inherits MPSNNFilterNode. Instance Methods (nonnull instancetype) - initWithSource:dataSource: Class Methods (nonnull instancetype) + nodeWithSource:dataSource: Properties MPSCNNBatchNormalizationFlags flags Detailed Description A node representing batch normalization for inference or training Batch normalization operates differently for inference and training. For inference, the normalization is done according to a static statistical representation of data saved during training. For training, this representation is ever evolving. In the low level MPS batch normalization interface, during training, the batch normalization is broken up into two steps: calculation of the statistical representation of input data, followed by normalization once the statistics are known for the entire batch. These are MPSCNNBatchNormalizationStatistics and MPSCNNBatchNormalization, respectively. When this node appears in a graph and is not required to produce a MPSCNNBatchNormalizationState -- that is, MPSCNNBatchNormalizationNode.resultState is not used within the graph -- then it operates in inference mode and new batch-only statistics are not calculated. When this state node is consumed, then the node is assumed to be in training mode and new statistics will be calculated and written to the MPSCNNBatchNormalizationState and passed along to the MPSCNNBatchNormalizationGradient and MPSCNNBatchNormalizationStatisticsGradient as necessary. This should allow you to construct an identical sequence of nodes for inference and training and expect the to right thing happen. Method Documentation - (nonnull instancetype) initWithSource: (MPSNNImageNode *__nonnull) source(nonnull id< MPSCNNBatchNormalizationDataSource >) dataSource + (nonnull instancetype) nodeWithSource: (MPSNNImageNode *__nonnull) source(nonnull id< MPSCNNBatchNormalizationDataSource >) dataSource Property Documentation - (MPSCNNBatchNormalizationFlags) flags [read], [write], [nonatomic], [assign] Options controlling how batch normalization is calculated Default: MPSCNNBatchNormalizationFlagsDefault Author Generated automatically by Doxygen for MetalPerformanceShaders.framework from the source code. Version MetalPerformanceShaders-100 Thu Feb 8 2018 MPSCNNBatchNormalizationNode(3)

Check Out this Related Man Page

MPSCNNBatchNormalization(3)				 MetalPerformanceShaders.framework			       MPSCNNBatchNormalization(3)

NAME
MPSCNNBatchNormalization SYNOPSIS
#import <MPSCNNBatchNormalization.h> Inherits MPSCNNKernel. Instance Methods (nonnull instancetype) - initWithDevice:dataSource: (nonnull instancetype) - initWithDevice: (nullable instancetype) - initWithCoder:device: (void) - encodeToCommandBuffer:sourceImage:batchNormalizationState:destinationImage: (void) - encodeBatchToCommandBuffer:sourceImages:batchNormalizationState:destinationImages: (MPSImage *__nonnull) - encodeToCommandBuffer:sourceImage:batchNormalizationState: (MPSImageBatch *__nonnull) - encodeBatchToCommandBuffer:sourceImages:batchNormalizationState: (MPSCNNBatchNormalizationState *__nullable) - resultStateForSourceImages: (MPSCNNBatchNormalizationState *__nullable) - temporaryResultStateForCommandBuffer:sourceImages: (void) - reloadDataSource: (void) - reloadGammaAndBetaWithCommandBuffer:gammaAndBetaState: Properties NSUInteger numberOfFeatureChannels float epsilon id< MPSCNNBatchNormalizationDataSource > dataSource Additional Inherited Members Detailed Description This depends on Metal.framework MPSCNNBatchNormalization normalizes input images using per-channel means and variances. for (c = 0; c < numberOfFeatureChannels; ++c) { input_image = in(:,:,c,:); output_image = (input_image - mean[c]) * gamma[c] / sqrt(variance[c] + epsilon) + beta[c]; out(:,:,c,:) = output_image; } Method Documentation - (MPSImageBatch * __nonnull) encodeBatchToCommandBuffer: (nonnull id< MTLCommandBuffer >) commandBuffer(MPSImageBatch *__nonnull) sourceImages(MPSCNNBatchNormalizationState *__nonnull) batchNormalizationState Encode this kernel to a command buffer for a batch of images using a batch normalization state. Create a batch of MPSImages to hold the result and return it. Parameters: commandBuffer A valid command buffer to receive the kernel. sourceImages The batch of source images. batchNormalizationState A MPSCNNBatchNormalizationState containing weights and/or statistics to use for the batch normalization. Returns: An MPSImageBatch containing the output of the graph. - (void) encodeBatchToCommandBuffer: (nonnull id< MTLCommandBuffer >) commandBuffer(MPSImageBatch *__nonnull) sourceImages(MPSCNNBatchNormalizationState *__nonnull) batchNormalizationState(MPSImageBatch *__nonnull) destinationImages Encode this kernel to a command buffer for a batch of images using a batch normalization state. Parameters: commandBuffer A valid command buffer to receive the kernel. sourceImages The batch of source images. batchNormalizationState A MPSCNNBatchNormalizationState containing weights and/or statistics to use for the batch normalization. destinationImages The batch of images to contain the normalized and scaled result images. - (MPSImage * __nonnull) encodeToCommandBuffer: (nonnull id< MTLCommandBuffer >) commandBuffer(MPSImage *__nonnull) sourceImage(MPSCNNBatchNormalizationState *__nonnull) batchNormalizationState Encode this kernel to a command buffer for a single image using a batch normalization state. Create a MPSImage to hold the result and return it. Parameters: commandBuffer A valid command buffer to receive the kernel. sourceImage The source MPSImage. batchNormalizationState A MPSCNNBatchNormalizationState containing weights and/or statistics to use for the batch normalization. Returns: An MPSImage containing the output of the graph. - (void) encodeToCommandBuffer: (nonnull id< MTLCommandBuffer >) commandBuffer(MPSImage *__nonnull) sourceImage(MPSCNNBatchNormalizationState *__nonnull) batchNormalizationState(MPSImage *__nonnull) destinationImage Encode this kernel to a command buffer for a single image using a batch normalization state. Parameters: commandBuffer A valid command buffer to receive the kernel. sourceImage The source MPSImage. batchNormalizationState A MPSCNNBatchNormalizationState containing weights and/or statistics to use for the batch normalization. destinationImage An MPSImage to contain the resulting normalized and scaled image. - (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 a subclass of NSCoder that implements the <MPSDeviceProvider> protocol to tell MPS the MTLDevice to use. Parameters: aDecoder The NSCoder subclass with your serialized MPSKernel device The MTLDevice on which to make the MPSKernel Returns: A new MPSCNNBatchNormalization 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< MPSCNNBatchNormalizationDataSource >) dataSource Initializes a batch normalization kernel using a data source. Parameters: device The MTLDevice on which this filter will be used dataSource A pointer to a object that conforms to the MPSCNNBatchNormalizationDataSource protocol. The data source provides filter weights and bias terms and, optionally, image statistics which may be used to perform the normalization. Returns: A valid MPSCNNBatchNormalization object or nil, if failure. - (void) reloadDataSource: (__nonnull id< MPSCNNBatchNormalizationDataSource >) dataSource Reinitialize the filter using a data source. Parameters: dataSource The data source which will provide the weights and, optionally, the image batch statistics with which to normalize. - (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. - (MPSCNNBatchNormalizationState * __nullable) resultStateForSourceImages: (MPSImageBatch *__nonnull) sourceImages Return an MPSCNNBatchNormalizationState object which may be used with a MPSCNNBatchNormalization filter. - (MPSCNNBatchNormalizationState * __nullable) temporaryResultStateForCommandBuffer: (nonnull id< MTLCommandBuffer >) commandBuffer(MPSImageBatch *__nonnull) sourceImages Return a temporary MPSCNNBatchNormalizationState object which may be used with a MPSCNNBatchNormalization filter. Property Documentation - (id<MPSCNNBatchNormalizationDataSource>) dataSource [read], [nonatomic], [retain] The data source the batch normalization was initialized with - epsilon [read], [write], [nonatomic], [assign] The epsilon value used in the batch normalization formula to bias the variance when normalizing. - numberOfFeatureChannels [read], [nonatomic], [assign] The number of feature channels in an image to be normalized. Author Generated automatically by Doxygen for MetalPerformanceShaders.framework from the source code. Version MetalPerformanceShaders-100 Thu Feb 8 2018 MPSCNNBatchNormalization(3)
Man Page