Package apple.metalperformanceshaders
Class MPSNNNeuronDescriptor
- java.lang.Object
-
- org.moe.natj.general.NativeObject
-
- org.moe.natj.objc.ObjCObject
-
- apple.NSObject
-
- apple.metalperformanceshaders.MPSNNNeuronDescriptor
-
- All Implemented Interfaces:
NSCoding,NSCopying,NSSecureCoding,NSObject
public class MPSNNNeuronDescriptor extends NSObject implements NSCopying, NSSecureCoding
MPSNNNeuronDescriptor [@dependency] This depends on Metal.framework The MPSNNNeuronDescriptor specifies a neuron descriptor. Supported neuron types: Neuron type "none": f(x) = x Parameters: none ReLU neuron filter: f(x) = x >= 0 ? x : a * x This is called Leaky ReLU in literature. Some literature defines classical ReLU as max(0, x). If you want this behavior, simply pass a = 0. Parameters: a For default behavior, set the value of a to 0.0f. Linear neuron filter: f(x) = a * x + b Parameters: a, b For default behavior, set the value of a to 1.0f and the value of b to 0.0f. Sigmoid neuron filter: f(x) = 1 / (1 + e^-x) Parameters: none Hard Sigmoid filter: f(x) = clamp((x * a) + b, 0, 1) Parameters: a, b For default behavior, set the value of a to 0.2f and the value of b to 0.5f. Hyperbolic tangent (TanH) neuron filter: f(x) = a * tanh(b * x) Parameters: a, b For default behavior, set the value of a to 1.0f and the value of b to 1.0f. Absolute neuron filter: f(x) = fabs(x) Parameters: none Parametric Soft Plus neuron filter: f(x) = a * log(1 + e^(b * x)) Parameters: a, b For default behavior, set the value of a to 1.0f and the value of b to 1.0f. Parametric Soft Sign neuron filter: f(x) = x / (1 + abs(x)) Parameters: none Parametric ELU neuron filter: f(x) = x >= 0 ? x : a * (exp(x) - 1) Parameters: a For default behavior, set the value of a to 1.0f. Parametric ReLU (PReLU) neuron filter: Same as ReLU, except parameter aArray is per channel. For each pixel, applies the following function: f(x_i) = x_i, if x_i >= 0 = a_i * x_i if x_i < 0 i in [0...channels-1] i.e. parameters a_i are learned and applied to each channel separately. Compare this to ReLu where parameter a is shared across all channels. See https://arxiv.org/pdf/1502.01852.pdf for details. Parameters: aArray - Array of floats containing per channel value of PReLu parameter count - Number of float values in array aArray. ReLUN neuron filter: f(x) = min((x >= 0 ? x : a * x), b) Parameters: a, b As an example, the TensorFlow Relu6 activation layer can be implemented by setting the parameter b to 6.0f: https://www.tensorflow.org/api_docs/cc/class/tensorflow/ops/relu6. For default behavior, set the value of a to 1.0f and the value of b to 6.0f.
-
-
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 protectedMPSNNNeuronDescriptor(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.floata()static booleanaccessInstanceVariablesDirectly()static MPSNNNeuronDescriptoralloc()static java.lang.ObjectallocWithZone(org.moe.natj.general.ptr.VoidPtr zone)static booleanautomaticallyNotifiesObserversForKey(java.lang.String key)floatb()floatc()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 MPSNNNeuronDescriptorcnnNeuronDescriptorWithType(int neuronType)Make a descriptor for a MPSCNNNeuron object.static MPSNNNeuronDescriptorcnnNeuronDescriptorWithTypeA(int neuronType, float a)Make a descriptor for a MPSCNNNeuron object.static MPSNNNeuronDescriptorcnnNeuronDescriptorWithTypeAB(int neuronType, float a, float b)Initialize the neuron descriptor.static MPSNNNeuronDescriptorcnnNeuronDescriptorWithTypeABC(int neuronType, float a, float b, float c)Make a descriptor for a MPSCNNNeuron object.static MPSNNNeuronDescriptorcnnNeuronPReLUDescriptorWithDataNoCopy(NSData data, boolean noCopy)Make a descriptor for a neuron of type MPSCNNNeuronTypePReLU.java.lang.ObjectcopyWithZone(org.moe.natj.general.ptr.VoidPtr zone)NSDatadata()Note: data is retained, not copiedstatic java.lang.StringdebugDescription_static()static java.lang.Stringdescription_static()voidencodeWithCoder(NSCoder coder)static longhash_static()MPSNNNeuronDescriptorinit()MPSNNNeuronDescriptorinitWithCoder(NSCoder coder)NS_DESIGNATED_INITIALIZERstatic 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)intneuronType()static java.lang.Objectnew_objc()static booleanresolveClassMethod(org.moe.natj.objc.SEL sel)static booleanresolveInstanceMethod(org.moe.natj.objc.SEL sel)voidsetA(float value)voidsetB(float value)voidsetC(float value)voidsetData(NSData value)Note: data is retained, not copiedvoidsetNeuronType(int value)static voidsetVersion_static(long aVersion)static org.moe.natj.objc.Classsuperclass_static()static booleansupportsSecureCoding()static longversion_static()-
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
-
a
public float a()
-
accessInstanceVariablesDirectly
public static boolean accessInstanceVariablesDirectly()
-
alloc
public static MPSNNNeuronDescriptor alloc()
-
allocWithZone
public static java.lang.Object allocWithZone(org.moe.natj.general.ptr.VoidPtr zone)
-
automaticallyNotifiesObserversForKey
public static boolean automaticallyNotifiesObserversForKey(java.lang.String key)
-
b
public float b()
-
c
public float c()
-
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()
-
cnnNeuronDescriptorWithType
public static MPSNNNeuronDescriptor cnnNeuronDescriptorWithType(int neuronType)
Make a descriptor for a MPSCNNNeuron object.- Parameters:
neuronType- The type of a neuron filter.- Returns:
- A valid MPSNNNeuronDescriptor object or nil, if failure.
-
cnnNeuronDescriptorWithTypeA
public static MPSNNNeuronDescriptor cnnNeuronDescriptorWithTypeA(int neuronType, float a)
Make a descriptor for a MPSCNNNeuron object.- Parameters:
neuronType- The type of a neuron filter.a- Parameter "a".- Returns:
- A valid MPSNNNeuronDescriptor object or nil, if failure.
-
cnnNeuronDescriptorWithTypeAB
public static MPSNNNeuronDescriptor cnnNeuronDescriptorWithTypeAB(int neuronType, float a, float b)
Initialize the neuron descriptor.- Parameters:
neuronType- The type of a neuron filter.a- Parameter "a".b- Parameter "b".- Returns:
- A valid MPSNNNeuronDescriptor object or nil, if failure.
-
cnnNeuronDescriptorWithTypeABC
public static MPSNNNeuronDescriptor cnnNeuronDescriptorWithTypeABC(int neuronType, float a, float b, float c)
Make a descriptor for a MPSCNNNeuron object.- Parameters:
neuronType- The type of a neuron filter.a- Parameter "a".b- Parameter "b".c- Parameter "c".- Returns:
- A valid MPSNNNeuronDescriptor object or nil, if failure.
-
cnnNeuronPReLUDescriptorWithDataNoCopy
public static MPSNNNeuronDescriptor cnnNeuronPReLUDescriptorWithDataNoCopy(NSData data, boolean noCopy)
Make a descriptor for a neuron of type MPSCNNNeuronTypePReLU. The PReLU neuron is the same as a ReLU neuron, except parameter "a" is per feature channel.- Parameters:
data- A NSData containing a float array with the per feature channel value of PReLu parameter. The number of float values in this array usually corresponds to number of output channels in a convolution layer. The descriptor retains the NSData object.noCopy- An optimization flag that tells us whether the NSData allocation is suitable for use directly with no copying of the data into internal storage. This allocation has to match the same restrictions as listed for the newBufferWithBytesNoCopy:length:options:deallocator: method of MTLBuffer.- Returns:
- A valid MPSNNNeuronDescriptor object for a neuron of type MPSCNNNeuronTypePReLU or nil, if failure
-
copyWithZone
public java.lang.Object copyWithZone(org.moe.natj.general.ptr.VoidPtr zone)
- Specified by:
copyWithZonein interfaceNSCopying
-
data
public NSData data()
Note: data is retained, not copied
-
debugDescription_static
public static java.lang.String debugDescription_static()
-
description_static
public static java.lang.String description_static()
-
encodeWithCoder
public void encodeWithCoder(NSCoder coder)
- Specified by:
encodeWithCoderin interfaceNSCoding
-
hash_static
public static long hash_static()
-
init
public MPSNNNeuronDescriptor init()
-
initWithCoder
public MPSNNNeuronDescriptor initWithCoder(NSCoder coder)
Description copied from interface:NSCodingNS_DESIGNATED_INITIALIZER- Specified by:
initWithCoderin interfaceNSCoding
-
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)
-
neuronType
public int neuronType()
-
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)
-
setA
public void setA(float value)
-
setB
public void setB(float value)
-
setC
public void setC(float value)
-
setData
public void setData(NSData value)
Note: data is retained, not copied
-
setNeuronType
public void setNeuronType(int value)
-
setVersion_static
public static void setVersion_static(long aVersion)
-
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
-
version_static
public static long version_static()
-
-