Class MPSNNPadGradient

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

    public class MPSNNPadGradient
    extends MPSCNNGradientKernel
    MPSNNPadGradient [@dependency] This depends on Metal.framework Computes the gradient for the @ref MPSNNPad layer. Since the padding forward operation typically increases the size of the image, the gradient operation decreases it. In case of zero or constant padding forward operation the gradient operation slices the input gradient and in other edge modes the padded values copied in the forward operation are summed together in the gradient operation. For Example for the @ref MPSImageEdgeModeClamp the forward operation with offset = -2, destSize = 8 or @ref paddingSizeBefore = 2, @ref paddingSizeAfter = 3, sourceSize = 3: [@code] Source Image: |--------------| | x0 | x1 | x2 | |--------------| Destination Image: |---------------------------------------| | x0 | x0 | x0 | x1 | x2 | x2 | x2 | x2 | |---------------------------------------| [@endcode] Then the gradient operation becomes: [@code] Source Gradient Image: |---------------------------------------| | d0 | d1 | d2 | d3 | d4 | d5 | d6 | d7 | |---------------------------------------| Destination Gradient Image: |-----------------------------| | d0+d1+d2 | d3 | d4+d5+d6+d7 | |-----------------------------| [@endcode] Another example with @ref MPSImageEdgeModeMirror, the forward operation with offset = -4, destSize = 8 or @ref paddingSizeBefore = 4, @ref paddingSizeAfter = 1, sourceSize = 3: [@code] Source Image: |--------------| | x0 | x1 | x2 | |--------------| Destination Image: |---------------------------------------| | x0 | x1 | x2 | x1 | x0 | x1 | x2 | x1 | |---------------------------------------| [@endcode] Then the gradient operation becomes: [@code] Source Gradient Image: |---------------------------------------| | d0 | d1 | d2 | d3 | d4 | d5 | d6 | d7 | |---------------------------------------| Destination Gradient Image: |-----------------------------| | d0+d4 | d1+d3+d5+d7 | d2+d6 | |-----------------------------| [@endcode] NOTE: There are no channel fill-values to use with @ref MPSImageEdgeModeConstant since the gradient values are independent of the constant of the forward pass. NOTE: In case the forward pass defined a slice operation in feature channels then the channels not read in the forward pass will be filled with zeros in the gradient pass.
    • Constructor Detail

      • MPSNNPadGradient

        protected MPSNNPadGradient​(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)
      • automaticallyNotifiesObserversForKey

        public static boolean automaticallyNotifiesObserversForKey​(java.lang.String key)
      • 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()
      • description_static

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

        public static long hash_static()
      • initWithCoderDevice

        public MPSNNPadGradient initWithCoderDevice​(NSCoder aDecoder,
                                                    java.lang.Object device)
        NSSecureCoding compatability See @ref MPSKernel#initWithCoder.
        Overrides:
        initWithCoderDevice in class MPSCNNGradientKernel
        Parameters:
        aDecoder - The NSCoder subclass with your serialized MPSNNPadGradient.
        device - The MTLDevice on which to make the MPSNNPadGradient.
        Returns:
        A new MPSNNPadGradient object, or nil if failure.
      • initWithDevice

        public MPSNNPadGradient initWithDevice​(java.lang.Object device)
        Initializes a MPSNNPadGradient filter
        Overrides:
        initWithDevice in class MPSCNNGradientKernel
        Parameters:
        device - The MTLDevice on which this filter will be used
        Returns:
        A valid MPSNNPadGradient 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)
      • 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)
      • 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()