public class MPSNNPad extends MPSCNNKernel
Describes a padding operation
You should not use this filter to zero pad your data in the XY-plane. This filter achieves padding by copying the input image and therefore should only be used in special circumstances where the normal padding operation, defined for most filters through [@ref] MPSNNPadding, cannot achieve the necessary padding. Therefore use this filter only when you need one of the special edge modes: @ref MPSImageEdgeModeConstant, [@ref] MPSImageEdgeModeMirror, @ref MPSImageEdgeModeMirrorWithEdge or, if you need padding in the feature-channel dimesion. In other cases use to @ref MPSNNPadding for best performance. This kernel copies data from source MPSImage into the destination MPSImage allowing special padding modes to be applied. It also enables easy to use arbitrary padding area sizes when used in conjuction with @ref destinationImageDescriptorForSourceImages:sourceStates: function. There are two main ways to control the amount of padding to be added in 'x' and 'y' image dimensions: - The first one involves passing in an existing MPSImage as the destination image to the @ref MPSCNNKernel encode call, in which case the padding size in (x,y) plane is defined by the user-specified @ref clipRect and @ref offset properties of the kernel. - In the second one the destination image size and @ref clipRect and @ref offset properties of the kernel are automatically computed by calling [@ref] destinationImageDescriptorForSourceImages:sourceStates: or the -encode calls that return the resulting image from the left hand side of the call. In this case, the properties [@ref] paddingSizeBefore and @ref paddingSizeAfter together with the source image dimensions define the size of the destination image and set the correct @ref offset and @ref clipRect properties to the filter. Padding in the feature channel dimension is handled a bit differently: the amount of padding is always determined by @ref paddingSizeBefore.channel and [@ref] paddingSizeAfter.channel for this direction and the amount of feature channels filled in the destination is determined by the number of active feature channels determined by @ref sourceFeatureChannelOffset and @ref sourceFeatureChannelMaxCount and the amount of padding to be added on each side of the source.
Example for feature channel indices: [@code] paddingSizeBefore.channel = 2, paddingSizeAfter.channel = 3, sourceFeatureChannelOffset = 1, sourceFeatureChannelMaxCount = 3, destinationFeatureChannelOffset = 4. We get the following padding operation:
Source: |-----------------------------| | x0 | x1 | x2 | x3 | x4 | x5 | |-----------------------------| Destination: |----------------------------------------------------------------| | - | - | - | - | 0 | 0 | x1 | x2 | x3 | 0 | 0 | 0 | - | |----------------------------------------------------------------|
And with @ref edgeMode = MPSImageEdgeModeMirrorWithEdge:
Source: |-----------------------------| | x0 | x1 | x2 | x3 | x4 | x5 | |-----------------------------| Destination: |----------------------------------------------------------------| | - | - | - | - | x2 | x1 | x1 | x2 | x3 | x3 | x2 | x1 | - | |----------------------------------------------------------------|
Here the symbols '-' denote pixels not written by the kernel.
NOTE: The 'channel' coordinate and size in sourceRegion can be set to other values than those with multiple of four channels, but the @ref destinationFeatureChannelOffset property must be multiple of four, which means that there are some limitations to what can be achieved with this filter alone.
[@endcode] [@NOTE] MPSNNPad is currently the only filter that supports [@ref] MPSImageEdgeModeMirror, @ref MPSImageEdgeModeMirrorWithEdge and [@ref] MPSImageEdgeModeConstant.
NSObject.Function_instanceMethodForSelector_ret, NSObject.Function_methodForSelector_ret| Modifier | Constructor and Description |
|---|---|
protected |
MPSNNPad(org.moe.natj.general.Pointer peer) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
_supportsSecureCoding()
This property must return YES on all classes that allow secure coding.
|
static boolean |
accessInstanceVariablesDirectly() |
static MPSNNPad |
alloc() |
static MPSNNPad |
allocWithZone(org.moe.natj.general.ptr.VoidPtr zone) |
static boolean |
automaticallyNotifiesObserversForKey(java.lang.String key) |
static void |
cancelPreviousPerformRequestsWithTarget(java.lang.Object aTarget) |
static void |
cancelPreviousPerformRequestsWithTargetSelectorObject(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.Class |
classForKeyedUnarchiver() |
static java.lang.String |
debugDescription_static() |
static java.lang.String |
description_static() |
float |
fillValue()
[@property] fillValue
|
static long |
hash_static() |
MPSNNPad |
init() |
MPSNNPad |
initWithCoder(NSCoder aDecoder)
NS_DESIGNATED_INITIALIZER
|
MPSNNPad |
initWithCoderDevice(NSCoder aDecoder,
java.lang.Object device)
NSSecureCoding compatability
|
MPSNNPad |
initWithDevice(java.lang.Object device)
Initialize a MPSNNPad kernel
|
MPSNNPad |
initWithDevicePaddingSizeBeforePaddingSizeAfter(MTLDevice device,
MPSImageCoordinate paddingSizeBefore,
MPSImageCoordinate paddingSizeAfter)
Initialize a MPSNNPad kernel
|
MPSNNPad |
initWithDevicePaddingSizeBeforePaddingSizeAfterFillValueArray(MTLDevice device,
MPSImageCoordinate paddingSizeBefore,
MPSImageCoordinate paddingSizeAfter,
NSData fillValueArray)
Initialize a MPSNNPad kernel
|
static NSObject.Function_instanceMethodForSelector_ret |
instanceMethodForSelector(org.moe.natj.objc.SEL aSelector) |
static NSMethodSignature |
instanceMethodSignatureForSelector(org.moe.natj.objc.SEL aSelector) |
static boolean |
instancesRespondToSelector(org.moe.natj.objc.SEL aSelector) |
static boolean |
isSubclassOfClass(org.moe.natj.objc.Class aClass) |
static NSSet<java.lang.String> |
keyPathsForValuesAffectingValueForKey(java.lang.String key) |
static MPSNNPad |
new_objc() |
MPSImageCoordinate |
paddingSizeAfter()
[@property] paddingSizeAfter
|
MPSImageCoordinate |
paddingSizeBefore()
[@property] paddingSizeBefore
|
static boolean |
resolveClassMethod(org.moe.natj.objc.SEL sel) |
static boolean |
resolveInstanceMethod(org.moe.natj.objc.SEL sel) |
void |
setFillValue(float value)
[@property] fillValue
|
void |
setPaddingSizeAfter(MPSImageCoordinate value)
[@property] paddingSizeAfter
|
void |
setPaddingSizeBefore(MPSImageCoordinate value)
[@property] paddingSizeBefore
|
static void |
setVersion_static(long aVersion) |
static org.moe.natj.objc.Class |
superclass_static() |
static boolean |
supportsSecureCoding() |
static long |
version_static() |
appendBatchBarrier, clipRect, destinationFeatureChannelOffset, destinationImageAllocator, destinationImageDescriptorForSourceImagesSourceStates, dilationRateX, dilationRateY, edgeMode, encodeToCommandBufferSourceImage, encodeToCommandBufferSourceImageDestinationImage, encodeToCommandBufferSourceImageDestinationStateDestinationImage, encodeToCommandBufferSourceImageDestinationStateDestinationStateIsTemporary, encodingStorageSizeForSourceImageSourceStatesDestinationImage, isBackwards, isResultStateReusedAcrossBatch, isStateModified, kernelHeight, kernelWidth, offset, padding, resultStateForSourceImageSourceStatesDestinationImage, setClipRect, setDestinationFeatureChannelOffset, setDestinationImageAllocator, setEdgeMode, setOffset, setPadding, setSourceFeatureChannelMaxCount, setSourceFeatureChannelOffset, sourceFeatureChannelMaxCount, sourceFeatureChannelOffset, strideInPixelsX, strideInPixelsY, temporaryResultStateForCommandBufferSourceImageSourceStatesDestinationImagecopyWithZone, copyWithZoneDevice, device, encodeWithCoder, label, options, setLabel, setOptionsaccessibilityActivate, 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, willChangeValuesAtIndexesForKeypublic static boolean accessInstanceVariablesDirectly()
public static MPSNNPad alloc()
public static MPSNNPad allocWithZone(org.moe.natj.general.ptr.VoidPtr zone)
public static boolean automaticallyNotifiesObserversForKey(java.lang.String key)
public static void cancelPreviousPerformRequestsWithTarget(java.lang.Object aTarget)
public static void cancelPreviousPerformRequestsWithTargetSelectorObject(java.lang.Object aTarget,
org.moe.natj.objc.SEL aSelector,
java.lang.Object anArgument)
public static NSArray<java.lang.String> classFallbacksForKeyedArchiver()
public static org.moe.natj.objc.Class classForKeyedUnarchiver()
public static java.lang.String debugDescription_static()
public static java.lang.String description_static()
public float fillValue()
Determines the constant value to apply when using @ref MPSImageEdgeModeConstant. Default: 0.0f. NOTE: this value is ignored if the filter is initialized with a per-channel fill value using @ref initWithDevice:paddingSizeBefore:paddingSizeAfter:fillValueArray:.
public static long hash_static()
public MPSNNPad init()
init in class MPSCNNKernelpublic MPSNNPad initWithCoder(NSCoder aDecoder)
NSCodinginitWithCoder in interface NSCodinginitWithCoder in class MPSCNNKernelpublic MPSNNPad initWithCoderDevice(NSCoder aDecoder, java.lang.Object device)
See @ref MPSKernel#initWithCoder.
initWithCoderDevice in class MPSCNNKernelaDecoder - The NSCoder subclass with your serialized MPSNNPaddevice - The MTLDevice on which to make the MPSNNPadpublic MPSNNPad initWithDevice(java.lang.Object device)
initWithDevice in class MPSCNNKerneldevice - The device the filter will run on.public MPSNNPad initWithDevicePaddingSizeBeforePaddingSizeAfter(MTLDevice device, MPSImageCoordinate paddingSizeBefore, MPSImageCoordinate paddingSizeAfter)
device - The device the filter will run onpaddingSizeBefore - The amount of padding to add before the source image - see details above.paddingSizeAfter - The amount of padding to add after the source image - see details above.public MPSNNPad initWithDevicePaddingSizeBeforePaddingSizeAfterFillValueArray(MTLDevice device, MPSImageCoordinate paddingSizeBefore, MPSImageCoordinate paddingSizeAfter, NSData fillValueArray)
device - The device the filter will run onpaddingSizeBefore - The amount of padding to add before the source image - see details above.paddingSizeAfter - The amount of padding to add after the source image - see details above.fillValueArray - A NSData containing a float array to use with @ref MPSImageEdgeModeConstant.
The first value of the array will correspond to the first feature channel
written out to the destination image and the number of float values in the
data must be at least as large as the number of feature channels written onto
the destination by the filter. Failing to pass a large enough array will
result in undefined behavior. Passing in nil is fine.public static NSObject.Function_instanceMethodForSelector_ret instanceMethodForSelector(org.moe.natj.objc.SEL aSelector)
public static NSMethodSignature instanceMethodSignatureForSelector(org.moe.natj.objc.SEL aSelector)
public static boolean instancesRespondToSelector(org.moe.natj.objc.SEL aSelector)
public static boolean isSubclassOfClass(org.moe.natj.objc.Class aClass)
public static NSSet<java.lang.String> keyPathsForValuesAffectingValueForKey(java.lang.String key)
public static MPSNNPad new_objc()
public MPSImageCoordinate paddingSizeAfter()
This property is used for automatically sizing the destination image for the function @ref destinationImageDescriptorForSourceImages:sourceStates:. Defines how much padding to assign on the right, bottom and higher feature channel indices of the image. NOTE: the x and y coordinates of this property are only used through @ref destinationImageDescriptorForSourceImages:sourceStates:, since the clipRect and offset together define the padding sizes in those directions, but the 'channel' size defines the amount of padding to be applied in the feature channel dimension after source feature channel index determined by the sum of [@ref] sourceFeatureChannelOffset and @ref sourceFeatureChannelMaxCount, naturally clipped to fit the feature channels in the provided source image. Default: { 0, 0, 0 }
public MPSImageCoordinate paddingSizeBefore()
This property is used for automatically sizing the destination image for the function @ref destinationImageDescriptorForSourceImages:sourceStates:. Defines how much padding to assign on the left, top and smaller feature channel indices of the image. NOTE: the x and y coordinates of this property are only used through @ref destinationImageDescriptorForSourceImages:sourceStates:, since the clipRect and offset together define the padding sizes in those directions, but the 'channel' size defines the amount of padding to be applied in the feature channel dimension, before the feature channels starting from feature channel index @ref sourceFeatureChannelOffset. Default: { 0, 0, 0 }
public static boolean resolveClassMethod(org.moe.natj.objc.SEL sel)
public static boolean resolveInstanceMethod(org.moe.natj.objc.SEL sel)
public void setFillValue(float value)
Determines the constant value to apply when using @ref MPSImageEdgeModeConstant. Default: 0.0f. NOTE: this value is ignored if the filter is initialized with a per-channel fill value using @ref initWithDevice:paddingSizeBefore:paddingSizeAfter:fillValueArray:.
public void setPaddingSizeAfter(MPSImageCoordinate value)
This property is used for automatically sizing the destination image for the function @ref destinationImageDescriptorForSourceImages:sourceStates:. Defines how much padding to assign on the right, bottom and higher feature channel indices of the image. NOTE: the x and y coordinates of this property are only used through @ref destinationImageDescriptorForSourceImages:sourceStates:, since the clipRect and offset together define the padding sizes in those directions, but the 'channel' size defines the amount of padding to be applied in the feature channel dimension after source feature channel index determined by the sum of [@ref] sourceFeatureChannelOffset and @ref sourceFeatureChannelMaxCount, naturally clipped to fit the feature channels in the provided source image. Default: { 0, 0, 0 }
public void setPaddingSizeBefore(MPSImageCoordinate value)
This property is used for automatically sizing the destination image for the function @ref destinationImageDescriptorForSourceImages:sourceStates:. Defines how much padding to assign on the left, top and smaller feature channel indices of the image. NOTE: the x and y coordinates of this property are only used through @ref destinationImageDescriptorForSourceImages:sourceStates:, since the clipRect and offset together define the padding sizes in those directions, but the 'channel' size defines the amount of padding to be applied in the feature channel dimension, before the feature channels starting from feature channel index @ref sourceFeatureChannelOffset. Default: { 0, 0, 0 }
public static void setVersion_static(long aVersion)
public static org.moe.natj.objc.Class superclass_static()
public static boolean supportsSecureCoding()
public boolean _supportsSecureCoding()
NSSecureCoding_supportsSecureCoding in interface NSSecureCoding_supportsSecureCoding in class MPSCNNKernelpublic static long version_static()