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. API-Since: 11.3
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default boolean_supportsSecureCoding()NSSecureCoding compatibility.@Nullable org.moe.natj.general.ptr.FloatPtrbeta()Returns a pointer to the bias terms for the batch normalization.default @NotNull MPSCNNBatchNormalizationDataSourcecopyWithZoneDevice(@Nullable org.moe.natj.general.ptr.VoidPtr zone, @Nullable MTLDevice device)Optional copy method to create a copy of the data source for use with a new device.default voidencodeWithCoder(@NotNull NSCoder aCoder)NSSecureCoding compatibility.default floatepsilon()An optional tiny number to use to maintain numerical stability.@Nullable org.moe.natj.general.ptr.FloatPtrgamma()Returns a pointer to the scale factors for the batch normalization.default @Nullable MPSCNNBatchNormalizationDataSourceinitWithCoder(@NotNull NSCoder aDecoder)NSSecureCoding compatibility.@Nullable java.lang.Stringlabel()A label that is transferred to the batch normalization filter at init time Overridden by a MPSCNNBatchNormalizationNode.label if it is non-nil.booleanload_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.@Nullable org.moe.natj.general.ptr.FloatPtrmean()Returns a pointer to batch mean values with which to initialize the state for a subsequent batch normalization.longnumberOfFeatureChannels()Returns the number of feature channels within images to be normalized using the supplied parameters.voidpurge()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.default booleanupdateGammaAndBetaWithBatchNormalizationState(@NotNull MPSCNNBatchNormalizationState batchNormalizationState)Compute new gamma and beta values using current values and gradients contained within a MPSCNNBatchNormalizationState.default @Nullable MPSCNNNormalizationGammaAndBetaStateupdateGammaAndBetaWithCommandBufferBatchNormalizationState(@NotNull MTLCommandBuffer commandBuffer, @NotNull MPSCNNBatchNormalizationState batchNormalizationState)Compute new gamma and beta values using current values and gradients contained within a MPSCNNBatchNormalizationState.default booleanupdateMeanAndVarianceWithBatchNormalizationState(@NotNull MPSCNNBatchNormalizationState batchNormalizationState)Compute new mean and variance values using current batch statistics contained within a MPSCNNBatchNormalizationState.default @Nullable MPSCNNNormalizationMeanAndVarianceStateupdateMeanAndVarianceWithCommandBufferBatchNormalizationState(@NotNull MTLCommandBuffer commandBuffer, @NotNull MPSCNNBatchNormalizationState batchNormalizationState)Compute new mean and variance values using current batch statistics contained within a MPSCNNBatchNormalizationState.@Nullable org.moe.natj.general.ptr.FloatPtrvariance()Returns a pointer to batch variance values with which to initialize the state for a subsequent batch normalization.-
Methods inherited from interface apple.foundation.protocol.NSCopying
copyWithZone
-
-
-
-
Method Detail
-
beta
@Nullable @Nullable 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
@NotNull default @NotNull MPSCNNBatchNormalizationDataSource copyWithZoneDevice(@Nullable @Nullable org.moe.natj.general.ptr.VoidPtr zone, @Nullable @Nullable 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. API-Since: 12.0
-
encodeWithCoder
default void encodeWithCoder(@NotNull @NotNull 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
@Nullable @Nullable org.moe.natj.general.ptr.FloatPtr gamma()
Returns a pointer to the scale factors for the batch normalization.
-
initWithCoder
@Nullable default @Nullable MPSCNNBatchNormalizationDataSource initWithCoder(@NotNull @NotNull NSCoder aDecoder)
NSSecureCoding compatibility.
-
label
@Nullable @Nullable 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
@Nullable @Nullable 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(@NotNull @NotNull 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
@Nullable default @Nullable MPSCNNNormalizationGammaAndBetaState updateGammaAndBetaWithCommandBufferBatchNormalizationState(@NotNull @NotNull MTLCommandBuffer commandBuffer, @NotNull @NotNull 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(@NotNull @NotNull 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. API-Since: 12.0
-
updateMeanAndVarianceWithCommandBufferBatchNormalizationState
@Nullable default @Nullable MPSCNNNormalizationMeanAndVarianceState updateMeanAndVarianceWithCommandBufferBatchNormalizationState(@NotNull @NotNull MTLCommandBuffer commandBuffer, @NotNull @NotNull 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. API-Since: 12.0
-
variance
@Nullable @Nullable 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.
-
-