Interface MPSCNNBatchNormalizationDataSource

  • All Superinterfaces:
    NSCopying

    public interface MPSCNNBatchNormalizationDataSource
    extends NSCopying
    [@protocol] MPSCNNBatchNormalizationDataSource The MPSCNNBatchNormalizationDataSource protocol declares the methods that an instance of MPSCNNBatchNormalizationState uses to initialize the scale factors, bias terms, and batch statistics.
    • Method Detail

      • beta

        org.moe.natj.general.ptr.FloatPtr beta()
        Returns a pointer to the bias terms for the batch normalization. If NULL then no bias is to be applied.
      • copyWithZoneDevice

        default java.lang.Object copyWithZoneDevice​(org.moe.natj.general.ptr.VoidPtr zone,
                                                    MTLDevice device)
        Optional copy method to create a copy of the data source for use with a new device.
        Parameters:
        zone - The NSZone on which to allocate.
        device - The device where the kernel which uses this data source will be used.
        Returns:
        A pointer to a copy of this data source.
      • encodeWithCoder

        default void encodeWithCoder​(NSCoder aCoder)
        NSSecureCoding compatibility.
      • epsilon

        default float epsilon()
        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
      • gamma

        org.moe.natj.general.ptr.FloatPtr gamma()
        Returns a pointer to the scale factors for the batch normalization.
      • initWithCoder

        default java.lang.Object initWithCoder​(NSCoder aDecoder)
        NSSecureCoding compatibility.
      • label

        java.lang.String label()
        A label that is transferred to the batch normalization filter at init time Overridden by a MPSCNNBatchNormalizationNode.label if it is non-nil.
      • load_objc

        boolean load_objc()
        Alerts the data source that the data will be needed soon Each load alert will be balanced by a purge later, when MPS no longer needs the data from this object. Load will always be called atleast once after initial construction or each purge of the object before anything else is called.
        Returns:
        Returns YES on success. If NO is returned, expect MPS object construction to fail.
      • mean

        org.moe.natj.general.ptr.FloatPtr mean()
        Returns a pointer to batch mean values with which to initialize the state for a subsequent batch normalization.
      • numberOfFeatureChannels

        long numberOfFeatureChannels()
        Returns the number of feature channels within images to be normalized using the supplied parameters.
      • purge

        void purge()
        Alerts the data source that the data is no longer needed Each load alert will be balanced by a purge later, when MPS no longer needs the data from this object.
      • _supportsSecureCoding

        default boolean _supportsSecureCoding()
        NSSecureCoding compatibility.
      • updateGammaAndBetaWithBatchNormalizationState

        default boolean updateGammaAndBetaWithBatchNormalizationState​(MPSCNNBatchNormalizationState batchNormalizationState)
        Compute new gamma and beta values using current values and gradients contained within a MPSCNNBatchNormalizationState. Perform the update using the CPU.
        Parameters:
        batchNormalizationState - The MPSCNNBatchNormalizationState object containing the current gamma and beta values and the gradient values.
        Returns:
        A boolean value indicating if the update was performed.
      • updateGammaAndBetaWithCommandBufferBatchNormalizationState

        default MPSCNNNormalizationGammaAndBetaState updateGammaAndBetaWithCommandBufferBatchNormalizationState​(MTLCommandBuffer commandBuffer,
                                                                                                                MPSCNNBatchNormalizationState batchNormalizationState)
        Compute new gamma and beta values using current values and gradients contained within a MPSCNNBatchNormalizationState. Perform the update using a GPU. This operation is expected to also decrement the read count of batchNormalizationState by 1.
        Parameters:
        commandBuffer - The command buffer on which to encode the update.
        batchNormalizationState - The MPSCNNBatchNormalizationState object containing the current gamma and beta values and the gradient values.
        Returns:
        A MPSCNNNormalizationMeanAndVarianceState object containing updated mean and variance values. If NULL, the MPSNNGraph batch normalization filter gamma and beta values will remain unmodified.
      • updateMeanAndVarianceWithBatchNormalizationState

        default boolean updateMeanAndVarianceWithBatchNormalizationState​(MPSCNNBatchNormalizationState batchNormalizationState)
        Compute new mean and variance values using current batch statistics contained within a MPSCNNBatchNormalizationState. Perform the update using the CPU.
        Parameters:
        batchNormalizationState - The MPSCNNBatchNormalizationState object containing the current batch statistics.
        Returns:
        A boolean value indicating if the update was performed.
      • updateMeanAndVarianceWithCommandBufferBatchNormalizationState

        default MPSCNNNormalizationMeanAndVarianceState updateMeanAndVarianceWithCommandBufferBatchNormalizationState​(MTLCommandBuffer commandBuffer,
                                                                                                                      MPSCNNBatchNormalizationState batchNormalizationState)
        Compute new mean and variance values using current batch statistics contained within a MPSCNNBatchNormalizationState. Perform the update using a GPU. This operation is expected to also decrement the read count of batchNormalizationState by 1.
        Parameters:
        commandBuffer - The command buffer on which to encode the update.
        batchNormalizationState - The MPSCNNBatchNormalizationState object containing the current batch statistics.
        Returns:
        A MPSCNNNormalizationMeanAndVarianceState object containing updated mean and variance values. If NULL, the MPSNNGraph batch normalization filter mean and variance values will remain unmodified.
      • variance

        org.moe.natj.general.ptr.FloatPtr variance()
        Returns a pointer to batch variance values with which to initialize the state for a subsequent batch normalization.