Class MPSCNNCrossChannelNormalizationGradient

  • All Implemented Interfaces:
    NSCoding, NSCopying, NSSecureCoding, NSObject

    public class MPSCNNCrossChannelNormalizationGradient
    extends MPSCNNGradientKernel
    MPSCNNCrossChannelNormalizationGradient [@dependency] This depends on Metal.framework Specifies the normalization gradient filter across feature channels. This normalization filter applies the filter to a local region across nearby feature channels, but with no spatial extent (i.e., they have shape kernelSize x 1 x 1). The normalized output is given by: Y(i,j,k) = X(i,j,k) / L(i,j,k)^beta, where the normalizing factor is: L(i,j,k) = delta + alpha/N * (sum_{q in Q(k)} X(i,j,q)^2, where N is the kernel size. The window Q(k) itself is defined as: Q(k) = [max(0, k-floor(N/2)), min(D-1, k+floor((N-1)/2)], where k is the feature channel index (running from 0 to D-1) and D is the number of feature channels, and alpha, beta and delta are paremeters. It is the end-users responsibility to ensure that the combination of the parameters delta and alpha does not result in a situation where the denominator becomes zero - in such situations the resulting pixel-value is undefined. OutputGradient: dZ/dX(i,j,k) = dZ/dY(i,j,k) * (L(i,j,k)^-beta) - 2 * alpha * beta * X(i,j,k) * ( sum_{r in R(k)} dZ/dY(i,j,r) * X(i,j,r) * (L(i,j,r) ^ (-beta-1)) ) N is the kernel size. The window L(i) and K(j) itself is defined as: R(k) = [max(0, k-floor((N-1)/2)), min(D-1, k+floor(N/2)] For correct gradient computation all parameters must be the same as the original normalization filter.
    • Constructor Detail

      • MPSCNNCrossChannelNormalizationGradient

        protected MPSCNNCrossChannelNormalizationGradient​(org.moe.natj.general.Pointer peer)
    • Method Detail

      • accessInstanceVariablesDirectly

        public static boolean accessInstanceVariablesDirectly()
      • allocWithZone

        public static java.lang.Object allocWithZone​(org.moe.natj.general.ptr.VoidPtr zone)
      • alpha

        public float alpha()
        [@property] alpha The value of alpha. Default is 1.0. Must be non-negative.
      • automaticallyNotifiesObserversForKey

        public static boolean automaticallyNotifiesObserversForKey​(java.lang.String key)
      • beta

        public float beta()
        [@property] beta The value of beta. Default is 5.0
      • cancelPreviousPerformRequestsWithTarget

        public static void cancelPreviousPerformRequestsWithTarget​(java.lang.Object aTarget)
      • cancelPreviousPerformRequestsWithTargetSelectorObject

        public static void cancelPreviousPerformRequestsWithTargetSelectorObject​(java.lang.Object aTarget,
                                                                                 org.moe.natj.objc.SEL aSelector,
                                                                                 java.lang.Object anArgument)
      • classFallbacksForKeyedArchiver

        public static NSArray<java.lang.String> classFallbacksForKeyedArchiver()
      • classForKeyedUnarchiver

        public static org.moe.natj.objc.Class classForKeyedUnarchiver()
      • debugDescription_static

        public static java.lang.String debugDescription_static()
      • delta

        public float delta()
        [@property] delta The value of delta. Default is 1.0
      • description_static

        public static java.lang.String description_static()
      • hash_static

        public static long hash_static()
      • initWithCoderDevice

        public MPSCNNCrossChannelNormalizationGradient initWithCoderDevice​(NSCoder aDecoder,
                                                                           java.lang.Object 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.
        Overrides:
        initWithCoderDevice in class MPSCNNGradientKernel
        Parameters:
        aDecoder - The NSCoder subclass with your serialized MPSKernel
        device - The MTLDevice on which to make the MPSKernel
        Returns:
        A new MPSKernel object, or nil if failure.
      • initWithDevice

        public MPSCNNCrossChannelNormalizationGradient initWithDevice​(java.lang.Object device)
        Description copied from class: MPSCNNGradientKernel
        Standard init with default properties per filter type
        Overrides:
        initWithDevice in class MPSCNNGradientKernel
        Parameters:
        device - The device that the filter will be used on. May not be NULL.
        Returns:
        A pointer to the newly initialized object. This will fail, returning nil if the device is not supported. Devices must be MTLFeatureSet_iOS_GPUFamily2_v1 or later.
      • initWithDeviceKernelSize

        public MPSCNNCrossChannelNormalizationGradient initWithDeviceKernelSize​(MTLDevice device,
                                                                                long kernelSize)
        Initialize a cross channel normalization gradient filter
        Parameters:
        device - The device the filter will run on
        kernelSize - The kernel filter size in each dimension.
        Returns:
        A valid MPSCNNCrossChannelNormalization object or nil, if failure.
      • instanceMethodSignatureForSelector

        public static NSMethodSignature instanceMethodSignatureForSelector​(org.moe.natj.objc.SEL aSelector)
      • instancesRespondToSelector

        public static boolean instancesRespondToSelector​(org.moe.natj.objc.SEL aSelector)
      • isSubclassOfClass

        public static boolean isSubclassOfClass​(org.moe.natj.objc.Class aClass)
      • kernelSize

        public long kernelSize()
        [@property] kernelSize The size of the square filter window. Default is 5
      • keyPathsForValuesAffectingValueForKey

        public static NSSet<java.lang.String> keyPathsForValuesAffectingValueForKey​(java.lang.String key)
      • new_objc

        public static java.lang.Object new_objc()
      • resolveClassMethod

        public static boolean resolveClassMethod​(org.moe.natj.objc.SEL sel)
      • resolveInstanceMethod

        public static boolean resolveInstanceMethod​(org.moe.natj.objc.SEL sel)
      • setAlpha

        public void setAlpha​(float value)
        [@property] alpha The value of alpha. Default is 1.0. Must be non-negative.
      • setBeta

        public void setBeta​(float value)
        [@property] beta The value of beta. Default is 5.0
      • setDelta

        public void setDelta​(float value)
        [@property] delta The value of delta. Default is 1.0
      • setVersion_static

        public static void setVersion_static​(long aVersion)
      • superclass_static

        public static org.moe.natj.objc.Class superclass_static()
      • supportsSecureCoding

        public static boolean supportsSecureCoding()
      • _supportsSecureCoding

        public boolean _supportsSecureCoding()
        Description copied from interface: NSSecureCoding
        This property must return YES on all classes that allow secure coding. Subclasses of classes that adopt NSSecureCoding and override initWithCoder: must also override this method and return YES. The Secure Coding Guide should be consulted when writing methods that decode data.
        Specified by:
        _supportsSecureCoding in interface NSSecureCoding
        Overrides:
        _supportsSecureCoding in class MPSCNNGradientKernel
      • version_static

        public static long version_static()