public class MLCMultiheadAttentionLayer extends MLCLayer
A multi-head attention layer
A multi-head "Scaled Dot-Product Attention" layer which attends to one or more entries in the input key-value pairs N=Batch, S=source length, L=target length, E = model(embedding) dimension, K = Key dimension, V = value dimension H = headCount. The sources to this layer are of shapes: Query:(N,L,E), Key:(N,S,K), Value:(N,S,V), KeyMask:(N,S), AttentionMask:(1,L,S) or (NxH,L,S). KeyMask and AttentionMask are optional and either, both or none of them can be passed. KeyMask is of Boolean type and AttentionMask can be of Float or Boolean type. Output is of shape:(N,L,E). For details refer to: https://pytorch.org/docs/stable/nn.html#multiheadattention
NSObject.Function_instanceMethodForSelector_ret, NSObject.Function_methodForSelector_ret| Modifier | Constructor and Description |
|---|---|
protected |
MLCMultiheadAttentionLayer(org.moe.natj.general.Pointer peer) |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
accessInstanceVariablesDirectly() |
static MLCMultiheadAttentionLayer |
alloc() |
static MLCMultiheadAttentionLayer |
allocWithZone(org.moe.natj.general.ptr.VoidPtr zone) |
NSArray<? extends MLCTensor> |
attentionBiases()
[@property] attentionBiases
|
static boolean |
automaticallyNotifiesObserversForKey(java.lang.String key) |
NSArray<? extends MLCTensor> |
biases()
[@property] biases
|
NSArray<? extends MLCTensorParameter> |
biasesParameters()
[@property] biasesParameters
|
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() |
MLCMultiheadAttentionDescriptor |
descriptor()
[@property] descriptor
|
static long |
hash_static() |
MLCMultiheadAttentionLayer |
init() |
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 MLCMultiheadAttentionLayer |
layerWithDescriptorWeightsBiasesAttentionBiases(MLCMultiheadAttentionDescriptor descriptor,
NSArray<? extends MLCTensor> weights,
NSArray<? extends MLCTensor> biases,
NSArray<? extends MLCTensor> attentionBiases)
Create a multi-head attention layer
|
static MLCMultiheadAttentionLayer |
new_objc() |
static boolean |
resolveClassMethod(org.moe.natj.objc.SEL sel) |
static boolean |
resolveInstanceMethod(org.moe.natj.objc.SEL sel) |
static void |
setVersion_static(long aVersion) |
static org.moe.natj.objc.Class |
superclass_static() |
static boolean |
supportsDataTypeOnDevice(int dataType,
MLCDevice device) |
static long |
version_static() |
NSArray<? extends MLCTensor> |
weights()
[@property] weights
|
NSArray<? extends MLCTensorParameter> |
weightsParameters()
[@property] weightsParameters
|
deviceType, isDebuggingEnabled, label, layerID, setIsDebuggingEnabled, setLabelaccessibilityActivate, 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 MLCMultiheadAttentionLayer(org.moe.natj.general.Pointer peer)
public static boolean accessInstanceVariablesDirectly()
public static MLCMultiheadAttentionLayer alloc()
public static MLCMultiheadAttentionLayer allocWithZone(org.moe.natj.general.ptr.VoidPtr zone)
public NSArray<? extends MLCTensor> attentionBiases()
The biases added to key and value
public static boolean automaticallyNotifiesObserversForKey(java.lang.String key)
public NSArray<? extends MLCTensor> biases()
The biases of query, key, value and output projections
public NSArray<? extends MLCTensorParameter> biasesParameters()
The biases tensor parameters used for optimizer update
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 MLCMultiheadAttentionDescriptor descriptor()
The multi-head attention descriptor
public static long hash_static()
public MLCMultiheadAttentionLayer init()
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 MLCMultiheadAttentionLayer layerWithDescriptorWeightsBiasesAttentionBiases(MLCMultiheadAttentionDescriptor descriptor, NSArray<? extends MLCTensor> weights, NSArray<? extends MLCTensor> biases, NSArray<? extends MLCTensor> attentionBiases)
weights - weights corresponding to query, key, value and output projections for all headsbiases - Optional, biases corresponding to query, key, value and output projections for all headsattentionBiases - Optional, An array of biases added to the key and value respectivelypublic static MLCMultiheadAttentionLayer new_objc()
public static boolean resolveClassMethod(org.moe.natj.objc.SEL sel)
public static boolean resolveInstanceMethod(org.moe.natj.objc.SEL sel)
public static void setVersion_static(long aVersion)
public static org.moe.natj.objc.Class superclass_static()
public static boolean supportsDataTypeOnDevice(int dataType,
MLCDevice device)
public static long version_static()
public NSArray<? extends MLCTensor> weights()
The weights of query, key, value and output projections
public NSArray<? extends MLCTensorParameter> weightsParameters()
The weights tensor parameters used for optimizer update