Package apple.metalperformanceshaders
Class MPSCNNPoolingGradient
- java.lang.Object
-
- org.moe.natj.general.NativeObject
-
- org.moe.natj.objc.ObjCObject
-
- apple.NSObject
-
- apple.metalperformanceshaders.MPSKernel
-
- apple.metalperformanceshaders.MPSCNNBinaryKernel
-
- apple.metalperformanceshaders.MPSCNNGradientKernel
-
- apple.metalperformanceshaders.MPSCNNPoolingGradient
-
- All Implemented Interfaces:
NSCoding,NSCopying,NSSecureCoding,NSObject
- Direct Known Subclasses:
MPSCNNDilatedPoolingMaxGradient,MPSCNNPoolingAverageGradient,MPSCNNPoolingL2NormGradient,MPSCNNPoolingMaxGradient
public class MPSCNNPoolingGradient extends MPSCNNGradientKernel
MPSCNNPoolingGradient [@dependency] This depends on Metal.framework Specifies the base class for computing the gradient of the pooling filters. The operation backpropagates a gradient vector using the chain rule. Given the input gradient vector dL(x) = dL/d out(x), which is the derivative of the loss-function wrt. (original) pooling filter output the output gradient at position y (dL/d in(y)) is computed as follows: dL/d in(y) = sum_x (dL/d out(x)) * (d out(x)/d in(y)), where the sum runs over the input gradient pixels starting from primaryOffset extending to primaryOffset + sourceSize. Note here that we need a separate variable 'sourceSize' to specify which input gradients are included in the output gradient computation as this information cannot be deduced directly from the cliprect size due to fractional striding or simply because the user wants to examine a subset of the contributions to the gradients. In normal operation the sourceSize is specified as the cliprect.size of the forward pooling filter in order to compute the gradients for all outputs the forward direction produced and the primaryOffset is set to cliprect.origin of the original forward pooling operation for the same reason. The cliprect property of the filter allows the user to send the gradients to a new location, which may not match the original forward pooling filter window locations: The index 'y' in the formula above refers to the pixel location in the secondary source, which is the source image of the original forward pooling filter and secondaryOffset specifies the center of the first pooling window as specified in MPSCNNPooling filter specification. The first (top leftmost) pixel written into the cliprect computes the derivative of the first pixel within the first pooling window that is contained within the secondary source image and subsequent values are defined by normal striding rules from secondary source to primary source. This means that typically the cliprect is set to fill the effective source area of the original forward operation, clamped to edges of the original source image, which in the normal case is the same size as the size of the gradient destination image. If there are any values in the destination cliprect that do not contribute to the forward pooling result in the area specified by primaryOffset and sourceSize, due to large strides or dilation factors or simply because all forward pass induced values would be outside the source area, then those result values are set to zero. The actual value of d out(x) / d in(y) depends on the pooling operation and these are defined in the subclasses of MPSCNNPoolingGradient.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class apple.NSObject
NSObject.Function_instanceMethodForSelector_ret, NSObject.Function_methodForSelector_ret
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedMPSCNNPoolingGradient(org.moe.natj.general.Pointer peer)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean_supportsSecureCoding()This property must return YES on all classes that allow secure coding.static booleanaccessInstanceVariablesDirectly()static MPSCNNPoolingGradientalloc()static java.lang.ObjectallocWithZone(org.moe.natj.general.ptr.VoidPtr zone)static booleanautomaticallyNotifiesObserversForKey(java.lang.String key)static voidcancelPreviousPerformRequestsWithTarget(java.lang.Object aTarget)static voidcancelPreviousPerformRequestsWithTargetSelectorObject(java.lang.Object aTarget, org.moe.natj.objc.SEL aSelector, java.lang.Object anArgument)static NSArray<java.lang.String>classFallbacksForKeyedArchiver()static org.moe.natj.objc.ClassclassForKeyedUnarchiver()static java.lang.StringdebugDescription_static()static java.lang.Stringdescription_static()static longhash_static()MPSCNNPoolingGradientinit()MPSCNNPoolingGradientinitWithCoder(NSCoder aDecoder)NS_DESIGNATED_INITIALIZERMPSCNNPoolingGradientinitWithCoderDevice(NSCoder aDecoder, java.lang.Object device)NSSecureCoding compatability See @ref MPSKernel#initWithCoder.MPSCNNPoolingGradientinitWithDevice(java.lang.Object device)Standard init with default properties per filter typeMPSCNNPoolingGradientinitWithDeviceKernelWidthKernelHeight(MTLDevice device, long kernelWidth, long kernelHeight)Initialize a gradient pooling filterMPSCNNPoolingGradientinitWithDeviceKernelWidthKernelHeightStrideInPixelsXStrideInPixelsY(MTLDevice device, long kernelWidth, long kernelHeight, long strideInPixelsX, long strideInPixelsY)Initialize a gradient pooling filterstatic NSObject.Function_instanceMethodForSelector_retinstanceMethodForSelector(org.moe.natj.objc.SEL aSelector)static NSMethodSignatureinstanceMethodSignatureForSelector(org.moe.natj.objc.SEL aSelector)static booleaninstancesRespondToSelector(org.moe.natj.objc.SEL aSelector)static booleanisSubclassOfClass(org.moe.natj.objc.Class aClass)static NSSet<java.lang.String>keyPathsForValuesAffectingValueForKey(java.lang.String key)static java.lang.Objectnew_objc()static booleanresolveClassMethod(org.moe.natj.objc.SEL sel)static booleanresolveInstanceMethod(org.moe.natj.objc.SEL sel)voidsetSourceSize(MTLSize value)[@property] sourceSize An optional source size which defines together with primaryOffset, the set of input gradient pixels to take into account in the gradient computations.static voidsetVersion_static(long aVersion)MTLSizesourceSize()[@property] sourceSize An optional source size which defines together with primaryOffset, the set of input gradient pixels to take into account in the gradient computations.static org.moe.natj.objc.Classsuperclass_static()static booleansupportsSecureCoding()static longversion_static()-
Methods inherited from class apple.metalperformanceshaders.MPSCNNGradientKernel
encodeToCommandBufferSourceGradientSourceImageGradientState, encodeToCommandBufferSourceGradientSourceImageGradientStateDestinationGradient, kernelOffsetX, kernelOffsetY, setKernelOffsetX, setKernelOffsetY
-
Methods inherited from class apple.metalperformanceshaders.MPSCNNBinaryKernel
appendBatchBarrier, clipRect, destinationFeatureChannelOffset, destinationImageAllocator, destinationImageDescriptorForSourceImagesSourceStates, encodeToCommandBufferPrimaryImageSecondaryImage, encodeToCommandBufferPrimaryImageSecondaryImageDestinationImage, encodeToCommandBufferPrimaryImageSecondaryImageDestinationStateDestinationStateIsTemporary, encodingStorageSizeForPrimaryImageSecondaryImageSourceStatesDestinationImage, isBackwards, isResultStateReusedAcrossBatch, isStateModified, padding, primaryDilationRateX, primaryDilationRateY, primaryEdgeMode, primaryKernelHeight, primaryKernelWidth, primaryOffset, primarySourceFeatureChannelMaxCount, primarySourceFeatureChannelOffset, primaryStrideInPixelsX, primaryStrideInPixelsY, resultStateForPrimaryImageSecondaryImageSourceStatesDestinationImage, secondaryDilationRateX, secondaryDilationRateY, secondaryEdgeMode, secondaryKernelHeight, secondaryKernelWidth, secondaryOffset, secondarySourceFeatureChannelMaxCount, secondarySourceFeatureChannelOffset, secondaryStrideInPixelsX, secondaryStrideInPixelsY, setClipRect, setDestinationFeatureChannelOffset, setDestinationImageAllocator, setPadding, setPrimaryEdgeMode, setPrimaryOffset, setPrimarySourceFeatureChannelMaxCount, setPrimarySourceFeatureChannelOffset, setPrimaryStrideInPixelsX, setPrimaryStrideInPixelsY, setSecondaryEdgeMode, setSecondaryOffset, setSecondarySourceFeatureChannelMaxCount, setSecondarySourceFeatureChannelOffset, setSecondaryStrideInPixelsX, setSecondaryStrideInPixelsY, temporaryResultStateForCommandBufferPrimaryImageSecondaryImageSourceStatesDestinationImage
-
Methods inherited from class apple.metalperformanceshaders.MPSKernel
copyWithZone, copyWithZoneDevice, device, encodeWithCoder, label, options, setLabel, setOptions
-
Methods inherited from class apple.NSObject
accessibilityActivate, accessibilityActivationPoint, accessibilityAssistiveTechnologyFocusedIdentifiers, accessibilityAttributedHint, accessibilityAttributedLabel, accessibilityAttributedUserInputLabels, accessibilityAttributedValue, accessibilityContainerType, accessibilityCustomActions, accessibilityCustomRotors, accessibilityDecrement, accessibilityDragSourceDescriptors, accessibilityDropPointDescriptors, accessibilityElementAtIndex, accessibilityElementCount, accessibilityElementDidBecomeFocused, accessibilityElementDidLoseFocus, accessibilityElementIsFocused, accessibilityElements, accessibilityElementsHidden, accessibilityFrame, accessibilityHint, accessibilityIncrement, accessibilityLabel, accessibilityLanguage, accessibilityNavigationStyle, accessibilityPath, accessibilityPerformEscape, accessibilityPerformMagicTap, accessibilityRespondsToUserInteraction, accessibilityScroll, accessibilityTextualContext, accessibilityTraits, accessibilityUserInputLabels, accessibilityValue, accessibilityViewIsModal, addObserverForKeyPathOptionsContext, attemptRecoveryFromErrorOptionIndex, attemptRecoveryFromErrorOptionIndexDelegateDidRecoverSelectorContextInfo, autoContentAccessingProxy, awakeAfterUsingCoder, awakeFromNib, class_objc, classForCoder, classForKeyedArchiver, copy, dealloc, debugDescription, description, dictionaryWithValuesForKeys, didChangeValueForKey, didChangeValueForKeyWithSetMutationUsingObjects, didChangeValuesAtIndexesForKey, doesNotRecognizeSelector, fileManagerShouldProceedAfterError, fileManagerWillProcessPath, finalize_objc, forwardingTargetForSelector, forwardInvocation, hash, indexOfAccessibilityElement, isAccessibilityElement, isEqual, isKindOfClass, isMemberOfClass, isProxy, methodForSelector, methodSignatureForSelector, mutableArrayValueForKey, mutableArrayValueForKeyPath, mutableCopy, mutableOrderedSetValueForKey, mutableOrderedSetValueForKeyPath, mutableSetValueForKey, mutableSetValueForKeyPath, observationInfo, observeValueForKeyPathOfObjectChangeContext, performSelector, performSelectorInBackgroundWithObject, performSelectorOnMainThreadWithObjectWaitUntilDone, performSelectorOnMainThreadWithObjectWaitUntilDoneModes, performSelectorOnThreadWithObjectWaitUntilDone, performSelectorOnThreadWithObjectWaitUntilDoneModes, performSelectorWithObject, performSelectorWithObjectAfterDelay, performSelectorWithObjectAfterDelayInModes, performSelectorWithObjectWithObject, prepareForInterfaceBuilder, provideImageDataBytesPerRowOrigin_Size_UserInfo, removeObserverForKeyPath, removeObserverForKeyPathContext, replacementObjectForCoder, replacementObjectForKeyedArchiver, respondsToSelector, self, setAccessibilityActivationPoint, setAccessibilityAttributedHint, setAccessibilityAttributedLabel, setAccessibilityAttributedUserInputLabels, setAccessibilityAttributedValue, setAccessibilityContainerType, setAccessibilityCustomActions, setAccessibilityCustomRotors, setAccessibilityDragSourceDescriptors, setAccessibilityDropPointDescriptors, setAccessibilityElements, setAccessibilityElementsHidden, setAccessibilityFrame, setAccessibilityHint, setAccessibilityLabel, setAccessibilityLanguage, setAccessibilityNavigationStyle, setAccessibilityPath, setAccessibilityRespondsToUserInteraction, setAccessibilityTextualContext, setAccessibilityTraits, setAccessibilityUserInputLabels, setAccessibilityValue, setAccessibilityViewIsModal, setIsAccessibilityElement, setNilValueForKey, setObservationInfo, setShouldGroupAccessibilityChildren, setValueForKey, setValueForKeyPath, setValueForUndefinedKey, setValuesForKeysWithDictionary, shouldGroupAccessibilityChildren, superclass, validateValueForKeyError, validateValueForKeyPathError, valueForKey, valueForKeyPath, valueForUndefinedKey, willChangeValueForKey, willChangeValueForKeyWithSetMutationUsingObjects, willChangeValuesAtIndexesForKey
-
-
-
-
Method Detail
-
accessInstanceVariablesDirectly
public static boolean accessInstanceVariablesDirectly()
-
alloc
public static MPSCNNPoolingGradient alloc()
-
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()
-
init
public MPSCNNPoolingGradient init()
- Overrides:
initin classMPSCNNGradientKernel
-
initWithCoder
public MPSCNNPoolingGradient initWithCoder(NSCoder aDecoder)
Description copied from interface:NSCodingNS_DESIGNATED_INITIALIZER- Specified by:
initWithCoderin interfaceNSCoding- Overrides:
initWithCoderin classMPSCNNGradientKernel
-
initWithCoderDevice
public MPSCNNPoolingGradient initWithCoderDevice(NSCoder aDecoder, java.lang.Object device)
NSSecureCoding compatability See @ref MPSKernel#initWithCoder.- Overrides:
initWithCoderDevicein classMPSCNNGradientKernel- Parameters:
aDecoder- The NSCoder subclass with your serialized MPSCNNPoolingGradientdevice- The MTLDevice on which to make the MPSCNNPoolingGradient- Returns:
- A new MPSCNNPooling object, or nil if failure.
-
initWithDevice
public MPSCNNPoolingGradient initWithDevice(java.lang.Object device)
Description copied from class:MPSCNNGradientKernelStandard init with default properties per filter type- Overrides:
initWithDevicein classMPSCNNGradientKernel- 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.
-
initWithDeviceKernelWidthKernelHeight
public MPSCNNPoolingGradient initWithDeviceKernelWidthKernelHeight(MTLDevice device, long kernelWidth, long kernelHeight)
Initialize a gradient pooling filter- Parameters:
device- The device the filter will run onkernelWidth- The width of the kernel. Can be an odd or even value.kernelHeight- The height of the kernel. Can be an odd or even value.- Returns:
- A valid MPSCNNPoolingGradient object or nil, if failure.
-
initWithDeviceKernelWidthKernelHeightStrideInPixelsXStrideInPixelsY
public MPSCNNPoolingGradient initWithDeviceKernelWidthKernelHeightStrideInPixelsXStrideInPixelsY(MTLDevice device, long kernelWidth, long kernelHeight, long strideInPixelsX, long strideInPixelsY)
Initialize a gradient pooling filter- Parameters:
device- The device the filter will run onkernelWidth- The width of the kernel. Can be an odd or even value.kernelHeight- The height of the kernel. Can be an odd or even value.strideInPixelsX- The input stride (upsampling factor) in the x dimension.strideInPixelsY- The input stride (upsampling factor) in the y dimension.- Returns:
- A valid MPSCNNPoolingGradient object or nil, if failure.
-
instanceMethodForSelector
public static NSObject.Function_instanceMethodForSelector_ret instanceMethodForSelector(org.moe.natj.objc.SEL aSelector)
-
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)
-
setSourceSize
public void setSourceSize(MTLSize value)
[@property] sourceSize An optional source size which defines together with primaryOffset, the set of input gradient pixels to take into account in the gradient computations. A MTLSize that together with primaryOffset indicates which part of the source gradient to consider. If the area does not lie completely within the primary source image, the intersection between source area rectangle and primary source bounds is used. Default: A size where every component is NSUIntegerMax indicating the entire rest of the image, starting from an offset (see primaryOffset).
-
setVersion_static
public static void setVersion_static(long aVersion)
-
sourceSize
public MTLSize sourceSize()
[@property] sourceSize An optional source size which defines together with primaryOffset, the set of input gradient pixels to take into account in the gradient computations. A MTLSize that together with primaryOffset indicates which part of the source gradient to consider. If the area does not lie completely within the primary source image, the intersection between source area rectangle and primary source bounds is used. Default: A size where every component is NSUIntegerMax indicating the entire rest of the image, starting from an offset (see primaryOffset).
-
superclass_static
public static org.moe.natj.objc.Class superclass_static()
-
supportsSecureCoding
public static boolean supportsSecureCoding()
-
_supportsSecureCoding
public boolean _supportsSecureCoding()
Description copied from interface:NSSecureCodingThis 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:
_supportsSecureCodingin interfaceNSSecureCoding- Overrides:
_supportsSecureCodingin classMPSCNNGradientKernel
-
version_static
public static long version_static()
-
-