public class MPSRNNImageInferenceLayer extends MPSCNNKernel
The MPSRNNImageInferenceLayer specifies a recurrent neural network layer for inference on MPSImages. Currently two types of recurrent layers are supported: ones that operate with convolutions on images: @ref MPSRNNImageInferenceLayer and one that operates on matrices: @ref MPSRNNMatrixInferenceLayer. The former can be often used to implement the latter by using 1x1-images, but due to image size restrictions and performance, it is advisable to use @ref MPSRNNMatrixInferenceLayer for linear recurrent layers. A MPSRNNImageInferenceLayer is initialized using a @ref MPSRNNLayerDescriptor, which further specifies the recurrent network layer, or an array of @ref MPSRNNLayerDescriptors, which specifies a stack of recurrent layers, that can operate in parallel a subset of the inputs in a sequence of inputs and recurrent outputs. Note that currently stacks with bidirectionally traversing encode functions do not support starting from a previous set of recurrent states, but this can be achieved quite easily by defining two separate unidirectional stacks of layers, and running the same input sequence on them separately (one forwards and one backwards) and ultimately combining the two result sequences as desired with auxiliary functions.
NSObject.Function_instanceMethodForSelector_ret, NSObject.Function_methodForSelector_ret| Modifier | Constructor and Description |
|---|---|
protected |
MPSRNNImageInferenceLayer(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 MPSRNNImageInferenceLayer |
alloc() |
static MPSRNNImageInferenceLayer |
allocWithZone(org.moe.natj.general.ptr.VoidPtr zone) |
static boolean |
automaticallyNotifiesObserversForKey(java.lang.String key) |
long |
bidirectionalCombineMode()
[@property] bidirectionalCombineMode
|
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() |
MPSRNNImageInferenceLayer |
copyWithZoneDevice(org.moe.natj.general.ptr.VoidPtr zone,
MTLDevice device)
Make a copy of this kernel for a new device - @see MPSKernel
|
static java.lang.String |
debugDescription_static() |
static java.lang.String |
description_static() |
void |
encodeBidirectionalSequenceToCommandBufferSourceSequenceDestinationForwardImagesDestinationBackwardImages(MTLCommandBuffer commandBuffer,
NSArray<? extends MPSImage> sourceSequence,
NSArray<? extends MPSImage> destinationForwardImages,
NSArray<? extends MPSImage> destinationBackwardImages)
Encode an MPSRNNImageInferenceLayer kernel stack for an input image sequences into a command buffer bidirectionally.
|
void |
encodeSequenceToCommandBufferSourceImagesDestinationImagesRecurrentInputStateRecurrentOutputStates(MTLCommandBuffer commandBuffer,
NSArray<? extends MPSImage> sourceImages,
NSArray<? extends MPSImage> destinationImages,
MPSRNNRecurrentImageState recurrentInputState,
NSMutableArray<MPSRNNRecurrentImageState> recurrentOutputStates)
Encode an MPSRNNImageInferenceLayer kernel (stack) for a sequence of inputs into a command buffer.
|
static long |
hash_static() |
MPSRNNImageInferenceLayer |
init() |
MPSRNNImageInferenceLayer |
initWithCoder(NSCoder aDecoder)
NS_DESIGNATED_INITIALIZER
|
MPSRNNImageInferenceLayer |
initWithCoderDevice(NSCoder aDecoder,
java.lang.Object device)
NSSecureCoding compatability
|
MPSRNNImageInferenceLayer |
initWithDevice(java.lang.Object device)
Standard init with default properties per filter type
|
MPSRNNImageInferenceLayer |
initWithDeviceRnnDescriptor(MTLDevice device,
MPSRNNDescriptor rnnDescriptor)
Initializes a convolutional RNN kernel
|
MPSRNNImageInferenceLayer |
initWithDeviceRnnDescriptors(MTLDevice device,
NSArray<? extends MPSRNNDescriptor> rnnDescriptors)
Initializes a kernel that implements a stack of convolutional RNN layers
|
long |
inputFeatureChannels()
[@property] inputFeatureChannels
|
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 MPSRNNImageInferenceLayer |
new_objc() |
long |
numberOfLayers()
[@property] numberOfLayers
|
long |
outputFeatureChannels()
[@property] outputFeatureChannels
|
boolean |
recurrentOutputIsTemporary()
[@property] recurrentOutputIsTemporary
|
static boolean |
resolveClassMethod(org.moe.natj.objc.SEL sel) |
static boolean |
resolveInstanceMethod(org.moe.natj.objc.SEL sel) |
void |
setBidirectionalCombineMode(long value)
[@property] bidirectionalCombineMode
|
void |
setRecurrentOutputIsTemporary(boolean value)
[@property] recurrentOutputIsTemporary
|
void |
setStoreAllIntermediateStates(boolean value)
[@property] storeAllIntermediateStates
|
static void |
setVersion_static(long aVersion) |
boolean |
storeAllIntermediateStates()
[@property] storeAllIntermediateStates
|
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, 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, willChangeValuesAtIndexesForKeyprotected MPSRNNImageInferenceLayer(org.moe.natj.general.Pointer peer)
public static boolean accessInstanceVariablesDirectly()
public static MPSRNNImageInferenceLayer alloc()
public static MPSRNNImageInferenceLayer allocWithZone(org.moe.natj.general.ptr.VoidPtr zone)
public static boolean automaticallyNotifiesObserversForKey(java.lang.String key)
public long bidirectionalCombineMode()
Defines how to combine the output-results, when encoding bidirectional layers using [@ref] encodeBidirectionalSequenceToCommandBuffer. Defaults to @ref MPSRNNBidirectionalCombineModeNone.
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 MPSRNNImageInferenceLayer copyWithZoneDevice(org.moe.natj.general.ptr.VoidPtr zone, MTLDevice device)
copyWithZoneDevice in class MPSKernelzone - The NSZone in which to allocate the objectdevice - The device for the new MPSKernel. If nil, then use
self.device.public static java.lang.String debugDescription_static()
public static java.lang.String description_static()
public void encodeBidirectionalSequenceToCommandBufferSourceSequenceDestinationForwardImagesDestinationBackwardImages(MTLCommandBuffer commandBuffer, NSArray<? extends MPSImage> sourceSequence, NSArray<? extends MPSImage> destinationForwardImages, NSArray<? extends MPSImage> destinationBackwardImages)
commandBuffer - A valid MTLCommandBuffer to receive the encoded filtersourceSequence - An array of valid MPSImage objects containing the source image sequence (x0, x1, ... x_n-1).destinationForwardImages - An array of valid MPSImages to be overwritten by result from forward input images. If bidirectionalCombineMode
is either MPSRNNBidirectionalCombineModeAdd or MPSRNNBidirectionalCombineModeConcatenate, then will
contain the combined results. destinationForwardImage may not alias with any of the source images.destinationBackwardImages - If bidirectionalCombineMode is MPSRNNBidirectionalCombineModeNone, then must be a valid MPSImage
that will be overwritten by result from backward input image. Otherwise this parameter is ignored
and can be nil. destinationBackwardImages may not alias to any of the source images.public void encodeSequenceToCommandBufferSourceImagesDestinationImagesRecurrentInputStateRecurrentOutputStates(MTLCommandBuffer commandBuffer, NSArray<? extends MPSImage> sourceImages, NSArray<? extends MPSImage> destinationImages, MPSRNNRecurrentImageState recurrentInputState, NSMutableArray<MPSRNNRecurrentImageState> recurrentOutputStates)
commandBuffer - A valid MTLCommandBuffer to receive the encoded filtersourceImages - An array of valid MPSImage objects containing the sequence of source images.destinationImages - An array valid MPSImages to be overwritten by result image sequence. destinationImages may not alias sourceImages.recurrentInputState - An optional state containing the output images and memory cells (for LSTMs)
of the layer obtained from the previous input images in a sequence of inputs.
Has to be the output of a previous call to this function or nil (assumed zero).
Note: can be one of the states returned in @ref recurrentOutputStates.recurrentOutputStates - An optional array that will contain the recurrent output states. If nil then
the recurrent output state is discarded.
If @ref storeAllIntermediateStates is YES, then all intermediate states of the sequence
are returned in the array, the first one corresponding to the first input in the sequence,
otherwise only the last recurrent output state is returned.
If recurrentOutputIsTemporary is YES and then all returned recurrent states
will be temporary. @see MPSState:isTemporary.
Example: In order to get a new state one can do the following:public static long hash_static()
public MPSRNNImageInferenceLayer init()
init in class MPSCNNKernelpublic MPSRNNImageInferenceLayer initWithCoder(NSCoder aDecoder)
NSCodinginitWithCoder in interface NSCodinginitWithCoder in class MPSCNNKernelpublic MPSRNNImageInferenceLayer initWithCoderDevice(NSCoder aDecoder, java.lang.Object device)
See @ref MPSKernel#initWithCoder.
initWithCoderDevice in class MPSCNNKernelaDecoder - The NSCoder subclass with your serialized MPSRNNImageInferenceLayerdevice - The MTLDevice on which to make the MPSRNNImageInferenceLayerpublic MPSRNNImageInferenceLayer initWithDevice(java.lang.Object device)
MPSCNNKernelinitWithDevice in class MPSCNNKerneldevice - The device that the filter will be used on. May not be NULL.public MPSRNNImageInferenceLayer initWithDeviceRnnDescriptor(MTLDevice device, MPSRNNDescriptor rnnDescriptor)
device - The MTLDevice on which this MPSRNNImageLayer filter will be usedrnnDescriptor - The descriptor that defines the RNN layerpublic MPSRNNImageInferenceLayer initWithDeviceRnnDescriptors(MTLDevice device, NSArray<? extends MPSRNNDescriptor> rnnDescriptors)
device - The MTLDevice on which this MPSRNNImageLayer filter will be usedrnnDescriptors - An array of RNN descriptors that defines a stack of RNN layers, starting at index zero.
The number of layers in stack is the number of entries in the array.
All entries in the array must be valid MPSRNNDescriptors.public long inputFeatureChannels()
The number of feature channels per pixel in the input image.
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 MPSRNNImageInferenceLayer new_objc()
public long numberOfLayers()
Number of layers in the filter-stack. This will be one when using initWithDevice:rnnDescriptor to initialize this filter and the number of entries in the array 'rnnDescriptors' when initializing this filter with initWithDevice:rnnDescriptors.
public long outputFeatureChannels()
The number of feature channels per pixel in the output image.
public boolean recurrentOutputIsTemporary()
How output states from @ref encodeSequenceToCommandBuffer are constructed. Defaults to NO. For reference @see MPSState.
public static boolean resolveClassMethod(org.moe.natj.objc.SEL sel)
public static boolean resolveInstanceMethod(org.moe.natj.objc.SEL sel)
public void setBidirectionalCombineMode(long value)
Defines how to combine the output-results, when encoding bidirectional layers using [@ref] encodeBidirectionalSequenceToCommandBuffer. Defaults to @ref MPSRNNBidirectionalCombineModeNone.
public void setRecurrentOutputIsTemporary(boolean value)
How output states from @ref encodeSequenceToCommandBuffer are constructed. Defaults to NO. For reference @see MPSState.
public void setStoreAllIntermediateStates(boolean value)
If YES then calls to @ref encodeSequenceToCommandBuffer return every recurrent state in the array: recurrentOutputStates. Defaults to NO.
public static void setVersion_static(long aVersion)
public boolean storeAllIntermediateStates()
If YES then calls to @ref encodeSequenceToCommandBuffer return every recurrent state in the array: recurrentOutputStates. Defaults to NO.
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()