public class MPSLSTMDescriptor extends MPSRNNDescriptor
The MPSLSTMDescriptor specifies a LSTM block/layer descriptor. The RNN layer initialized with a MPSLSTMDescriptor transforms the input data (image or matrix), the memory cell data and previous output with a set of filters, each producing one feature map in the output data and memory cell, according to the LSTM formulae detailed below. The user may provide the LSTM unit a single input or a sequence of inputs.
Description of operation:
Let x_j be the input data (at time index t of sequence, j index containing quadruplet: batch index, x,y and feature index (x=y=0 for matrices)). Let h0_j be the recurrent input (previous output) data from previous time step (at time index t-1 of sequence). Let h1_i be the output data produced at this time step. Let c0_j be the previous memory cell data (at time index t-1 of sequence). Let c1_i be the new memory cell data (at time index t-1 of sequence).
Let Wi_ij, Ui_ij, Vi_ij, be the input gate weights for input, recurrent input and memory cell (peephole) data respectively Let bi_i be the bias for the input gate
Let Wf_ij, Uf_ij, Vf_ij, be the forget gate weights for input, recurrent input and memory cell data respectively Let bf_i be the bias for the forget gate
Let Wo_ij, Uo_ij, Vo_ij, be the output gate weights for input, recurrent input and memory cell data respectively Let bo_i be the bias for the output gate
Let Wc_ij, Uc_ij, Vc_ij, be the memory cell gate weights for input, recurrent input and memory cell data respectively Let bc_i be the bias for the memory cell gate
Let gi(x), gf(x), go(x), gc(x) be neuron activation function for the input, forget, output gate and memory cell gate Let gh(x) be the activation function applied to result memory cell data
Then the new memory cell data c1_j and output image h1_i are computed as follows:
I_i = gi( Wi_ij * x_j + Ui_ij * h0_j + Vi_ij * c0_j + bi_i ) F_i = gf( Wf_ij * x_j + Uf_ij * h0_j + Vf_ij * c0_j + bf_i ) C_i = gc( Wc_ij * x_j + Uc_ij * h0_j + Vc_ij * c0_j + bc_i )
c1_i = F_i c0_i + I_i C_i
O_i = go( Wo_ij * x_j + Uo_ij * h0_j + Vo_ij * c1_j + bo_i )
h1_i = O_i gh( c1_i )
The '*' stands for convolution (see @ref MPSRNNImageInferenceLayer) or matrix-vector/matrix multiplication (see @ref MPSRNNMatrixInferenceLayer). Summation is over index j (except for the batch index), but there is no summation over repeated index i - the output index. Note that for validity all intermediate images have to be of same size and all U and V matrices have to be square (ie. outputFeatureChannels == inputFeatureChannels in those). Also the bias terms are scalars wrt. spatial dimensions.
NSObject.Function_instanceMethodForSelector_ret, NSObject.Function_methodForSelector_ret| Modifier | Constructor and Description |
|---|---|
protected |
MPSLSTMDescriptor(org.moe.natj.general.Pointer peer) |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
accessInstanceVariablesDirectly() |
static MPSLSTMDescriptor |
alloc() |
static MPSLSTMDescriptor |
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) |
MPSCNNConvolutionDataSource |
cellGateInputWeights()
[@property] cellGateInputWeights
|
MPSCNNConvolutionDataSource |
cellGateMemoryWeights()
[@property] cellGateMemoryWeights
|
MPSCNNConvolutionDataSource |
cellGateRecurrentWeights()
[@property] cellGateRecurrentWeights
|
float |
cellToOutputNeuronParamA()
[@property] cellToOutputNeuronParamA
|
float |
cellToOutputNeuronParamB()
[@property] cellToOutputNeuronParamB
|
float |
cellToOutputNeuronParamC()
[@property] cellToOutputNeuronParamC
|
int |
cellToOutputNeuronType()
[@property] cellToOutputNeuronType
|
static NSArray<java.lang.String> |
classFallbacksForKeyedArchiver() |
static org.moe.natj.objc.Class |
classForKeyedUnarchiver() |
static MPSLSTMDescriptor |
createLSTMDescriptorWithInputFeatureChannelsOutputFeatureChannels(long inputFeatureChannels,
long outputFeatureChannels)
Creates a LSTM descriptor.
|
static java.lang.String |
debugDescription_static() |
static java.lang.String |
description_static() |
MPSCNNConvolutionDataSource |
forgetGateInputWeights()
[@property] forgetGateInputWeights
|
MPSCNNConvolutionDataSource |
forgetGateMemoryWeights()
[@property] forgetGateMemoryWeights
|
MPSCNNConvolutionDataSource |
forgetGateRecurrentWeights()
[@property] forgetGateRecurrentWeights
|
static long |
hash_static() |
MPSLSTMDescriptor |
init() |
MPSCNNConvolutionDataSource |
inputGateInputWeights()
[@property] inputGateInputWeights
|
MPSCNNConvolutionDataSource |
inputGateMemoryWeights()
[@property] inputGateMemoryWeights
|
MPSCNNConvolutionDataSource |
inputGateRecurrentWeights()
[@property] inputGateRecurrentWeights
|
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) |
boolean |
memoryWeightsAreDiagonal()
[@property] memoryWeightsAreDiagonal
|
static MPSLSTMDescriptor |
new_objc() |
MPSCNNConvolutionDataSource |
outputGateInputWeights()
[@property] outputGateInputWeights
|
MPSCNNConvolutionDataSource |
outputGateMemoryWeights()
[@property] outputGateMemoryWeights
|
MPSCNNConvolutionDataSource |
outputGateRecurrentWeights()
[@property] outputGateRecurrentWeights
|
static boolean |
resolveClassMethod(org.moe.natj.objc.SEL sel) |
static boolean |
resolveInstanceMethod(org.moe.natj.objc.SEL sel) |
void |
setCellGateInputWeights(MPSCNNConvolutionDataSource value)
[@property] cellGateInputWeights
|
void |
setCellGateMemoryWeights(MPSCNNConvolutionDataSource value)
[@property] cellGateMemoryWeights
|
void |
setCellGateRecurrentWeights(MPSCNNConvolutionDataSource value)
[@property] cellGateRecurrentWeights
|
void |
setCellToOutputNeuronParamA(float value)
[@property] cellToOutputNeuronParamA
|
void |
setCellToOutputNeuronParamB(float value)
[@property] cellToOutputNeuronParamB
|
void |
setCellToOutputNeuronParamC(float value)
[@property] cellToOutputNeuronParamC
|
void |
setCellToOutputNeuronType(int value)
[@property] cellToOutputNeuronType
|
void |
setForgetGateInputWeights(MPSCNNConvolutionDataSource value)
[@property] forgetGateInputWeights
|
void |
setForgetGateMemoryWeights(MPSCNNConvolutionDataSource value)
[@property] forgetGateMemoryWeights
|
void |
setForgetGateRecurrentWeights(MPSCNNConvolutionDataSource value)
[@property] forgetGateRecurrentWeights
|
void |
setInputGateInputWeights(MPSCNNConvolutionDataSource value)
[@property] inputGateInputWeights
|
void |
setInputGateMemoryWeights(MPSCNNConvolutionDataSource value)
[@property] inputGateMemoryWeights
|
void |
setInputGateRecurrentWeights(MPSCNNConvolutionDataSource value)
[@property] inputGateRecurrentWeights
|
void |
setMemoryWeightsAreDiagonal(boolean value)
[@property] memoryWeightsAreDiagonal
|
void |
setOutputGateInputWeights(MPSCNNConvolutionDataSource value)
[@property] outputGateInputWeights
|
void |
setOutputGateMemoryWeights(MPSCNNConvolutionDataSource value)
[@property] outputGateMemoryWeights
|
void |
setOutputGateRecurrentWeights(MPSCNNConvolutionDataSource value)
[@property] outputGateRecurrentWeights
|
static void |
setVersion_static(long aVersion) |
static org.moe.natj.objc.Class |
superclass_static() |
static long |
version_static() |
inputFeatureChannels, layerSequenceDirection, outputFeatureChannels, setInputFeatureChannels, setLayerSequenceDirection, setOutputFeatureChannels, setUseFloat32Weights, setUseLayerInputUnitTransformMode, useFloat32Weights, useLayerInputUnitTransformModeaccessibilityActivate, 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 MPSLSTMDescriptor alloc()
public static MPSLSTMDescriptor 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 MPSCNNConvolutionDataSource cellGateInputWeights()
Contains weights 'Wc_ij', bias 'bc_i' and neuron 'gc' from the LSTM formula. If nil then assumed zero weights, bias and no neuron (identity mapping). Defaults to nil.
public MPSCNNConvolutionDataSource cellGateMemoryWeights()
Contains weights 'Vc_ij' - the 'peephole' weights - from the LSTM formula. if YES == memoryWeightsAreDiagonal, then the number of weights used is the number of features in the memory cell image/matrix. If nil then assumed zero weights. Defaults to nil.
public MPSCNNConvolutionDataSource cellGateRecurrentWeights()
Contains weights 'Uc_ij' from the LSTM formula. If nil then assumed zero weights. Defaults to nil.
public float cellToOutputNeuronParamA()
Neuron parameter A for 'gh'. Defaults to 1.0f.
public float cellToOutputNeuronParamB()
Neuron parameter B for 'gh'. Defaults to 1.0f.
public int cellToOutputNeuronType()
Neuron type definition for 'gh', see @ref MPSCNNNeuronType. Defaults to MPSCNNNeuronTypeTanH.
public static NSArray<java.lang.String> classFallbacksForKeyedArchiver()
public static org.moe.natj.objc.Class classForKeyedUnarchiver()
public static MPSLSTMDescriptor createLSTMDescriptorWithInputFeatureChannelsOutputFeatureChannels(long inputFeatureChannels, long outputFeatureChannels)
inputFeatureChannels - The number of feature channels in the input image/matrix. Must be >= 1.outputFeatureChannels - The number of feature channels in the output image/matrix. Must be >= 1.public static java.lang.String debugDescription_static()
public static java.lang.String description_static()
public MPSCNNConvolutionDataSource forgetGateInputWeights()
Contains weights 'Wf_ij', bias 'bf_i' and neuron 'gf' from the LSTM formula. If nil then assumed zero weights, bias and no neuron (identity mapping).Defaults to nil.
public MPSCNNConvolutionDataSource forgetGateMemoryWeights()
Contains weights 'Vf_ij' - the 'peephole' weights - from the LSTM formula. if YES == memoryWeightsAreDiagonal, then the number of weights used is the number of features in the memory cell image/matrix. If nil then assumed zero weights. Defaults to nil.
public MPSCNNConvolutionDataSource forgetGateRecurrentWeights()
Contains weights 'Uf_ij' from the LSTM formula. If nil then assumed zero weights. Defaults to nil.
public static long hash_static()
public MPSLSTMDescriptor init()
init in class MPSRNNDescriptorpublic MPSCNNConvolutionDataSource inputGateInputWeights()
Contains weights 'Wi_ij', bias 'bi_i' and neuron 'gi' from the LSTM formula. If nil then assumed zero weights, bias and no neuron (identity mapping). Defaults to nil.
public MPSCNNConvolutionDataSource inputGateMemoryWeights()
Contains weights 'Vi_ij' - the 'peephole' weights - from the LSTM formula. if YES == memoryWeightsAreDiagonal, then the number of weights used is the number of features in the memory cell image/matrix. If nil then assumed zero weights. Defaults to nil.
public MPSCNNConvolutionDataSource inputGateRecurrentWeights()
Contains weights 'Ui_ij' from the LSTM formula. If nil then assumed zero weights. Defaults to nil.
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 boolean memoryWeightsAreDiagonal()
If YES, then the 'peephole' weight matrices will be diagonal matrices represented as vectors of length the number of features in memory cells, that will be multiplied pointwise with the peephole matrix or image in order to achieve the diagonal (nonmixing) update. Defaults to NO.
public static MPSLSTMDescriptor new_objc()
public MPSCNNConvolutionDataSource outputGateInputWeights()
Contains weights 'Wo_ij', bias 'bo_i' and neuron 'go' from the LSTM formula. If nil then assumed zero weights, bias and no neuron (identity mapping). Defaults to nil.
public MPSCNNConvolutionDataSource outputGateMemoryWeights()
Contains weights 'Vo_ij' - the 'peephole' weights - from the LSTM. if YES == memoryWeightsAreDiagonal, then the number of weights used is the number of features in the memory cell image/matrix. If nil then assumed zero weights. Defaults to nil.
public MPSCNNConvolutionDataSource outputGateRecurrentWeights()
Contains weights 'Uo_ij' from the LSTM formula. If nil then assumed zero weights. Defaults to nil.
public static boolean resolveClassMethod(org.moe.natj.objc.SEL sel)
public static boolean resolveInstanceMethod(org.moe.natj.objc.SEL sel)
public void setCellGateInputWeights(MPSCNNConvolutionDataSource value)
Contains weights 'Wc_ij', bias 'bc_i' and neuron 'gc' from the LSTM formula. If nil then assumed zero weights, bias and no neuron (identity mapping). Defaults to nil.
public void setCellGateMemoryWeights(MPSCNNConvolutionDataSource value)
Contains weights 'Vc_ij' - the 'peephole' weights - from the LSTM formula. if YES == memoryWeightsAreDiagonal, then the number of weights used is the number of features in the memory cell image/matrix. If nil then assumed zero weights. Defaults to nil.
public void setCellGateRecurrentWeights(MPSCNNConvolutionDataSource value)
Contains weights 'Uc_ij' from the LSTM formula. If nil then assumed zero weights. Defaults to nil.
public void setCellToOutputNeuronParamA(float value)
Neuron parameter A for 'gh'. Defaults to 1.0f.
public void setCellToOutputNeuronParamB(float value)
Neuron parameter B for 'gh'. Defaults to 1.0f.
public void setCellToOutputNeuronType(int value)
Neuron type definition for 'gh', see @ref MPSCNNNeuronType. Defaults to MPSCNNNeuronTypeTanH.
public void setForgetGateInputWeights(MPSCNNConvolutionDataSource value)
Contains weights 'Wf_ij', bias 'bf_i' and neuron 'gf' from the LSTM formula. If nil then assumed zero weights, bias and no neuron (identity mapping).Defaults to nil.
public void setForgetGateMemoryWeights(MPSCNNConvolutionDataSource value)
Contains weights 'Vf_ij' - the 'peephole' weights - from the LSTM formula. if YES == memoryWeightsAreDiagonal, then the number of weights used is the number of features in the memory cell image/matrix. If nil then assumed zero weights. Defaults to nil.
public void setForgetGateRecurrentWeights(MPSCNNConvolutionDataSource value)
Contains weights 'Uf_ij' from the LSTM formula. If nil then assumed zero weights. Defaults to nil.
public void setInputGateInputWeights(MPSCNNConvolutionDataSource value)
Contains weights 'Wi_ij', bias 'bi_i' and neuron 'gi' from the LSTM formula. If nil then assumed zero weights, bias and no neuron (identity mapping). Defaults to nil.
public void setInputGateMemoryWeights(MPSCNNConvolutionDataSource value)
Contains weights 'Vi_ij' - the 'peephole' weights - from the LSTM formula. if YES == memoryWeightsAreDiagonal, then the number of weights used is the number of features in the memory cell image/matrix. If nil then assumed zero weights. Defaults to nil.
public void setInputGateRecurrentWeights(MPSCNNConvolutionDataSource value)
Contains weights 'Ui_ij' from the LSTM formula. If nil then assumed zero weights. Defaults to nil.
public void setMemoryWeightsAreDiagonal(boolean value)
If YES, then the 'peephole' weight matrices will be diagonal matrices represented as vectors of length the number of features in memory cells, that will be multiplied pointwise with the peephole matrix or image in order to achieve the diagonal (nonmixing) update. Defaults to NO.
public void setOutputGateInputWeights(MPSCNNConvolutionDataSource value)
Contains weights 'Wo_ij', bias 'bo_i' and neuron 'go' from the LSTM formula. If nil then assumed zero weights, bias and no neuron (identity mapping). Defaults to nil.
public void setOutputGateMemoryWeights(MPSCNNConvolutionDataSource value)
Contains weights 'Vo_ij' - the 'peephole' weights - from the LSTM. if YES == memoryWeightsAreDiagonal, then the number of weights used is the number of features in the memory cell image/matrix. If nil then assumed zero weights. Defaults to nil.
public void setOutputGateRecurrentWeights(MPSCNNConvolutionDataSource value)
Contains weights 'Uo_ij' from the LSTM formula. If nil then assumed zero weights. Defaults to nil.
public static void setVersion_static(long aVersion)
public static org.moe.natj.objc.Class superclass_static()
public static long version_static()
public float cellToOutputNeuronParamC()
Neuron parameter C for 'gh'. Defaults to 1.0f.
public void setCellToOutputNeuronParamC(float value)
Neuron parameter C for 'gh'. Defaults to 1.0f.