Class MPSNNOptimizer

  • All Implemented Interfaces:
    NSCoding, NSCopying, NSSecureCoding, NSObject
    Direct Known Subclasses:
    MPSNNOptimizerAdam, MPSNNOptimizerRMSProp, MPSNNOptimizerStochasticGradientDescent

    public class MPSNNOptimizer
    extends MPSKernel
    MPSNNOptimizer The MPSNNOptimizer base class, use one of the child classes, not to be directly used. Optimizers are generally used to update trainable neural network parameters. Users are usually expected to call these MPSKernels from the update methods on their Convolution or BatchNormalization data sources. Before the gradient is used to update the original value, some preprocessing occurs on each gradient where it is scaled or clipped If regularization is chosen the appropriate regularization loss gradient is added to the value gradient.
    • Constructor Detail

      • MPSNNOptimizer

        protected MPSNNOptimizer​(org.moe.natj.general.Pointer peer)
    • Method Detail

      • accessInstanceVariablesDirectly

        public static boolean accessInstanceVariablesDirectly()
      • allocWithZone

        public static java.lang.Object allocWithZone​(org.moe.natj.general.ptr.VoidPtr zone)
      • applyGradientClipping

        public boolean applyGradientClipping()
        [@property] applyGradientClipping A bool which decides if gradient will be clipped The default value is NO
      • automaticallyNotifiesObserversForKey

        public static boolean automaticallyNotifiesObserversForKey​(java.lang.String key)
      • 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()
      • debugDescription_static

        public static java.lang.String debugDescription_static()
      • description_static

        public static java.lang.String description_static()
      • gradientClipMax

        public float gradientClipMax()
        [@property] gradientClipMax The maximum value at which incoming gradient will be clipped before rescaling, applyGradientClipping must be true
      • gradientClipMin

        public float gradientClipMin()
        [@property] gradientClipMin The minimum value at which incoming gradient will be clipped before rescaling, applyGradientClipping must be true
      • gradientRescale

        public float gradientRescale()
        [@property] gradientRescale The gradientRescale at which we apply to incoming gradient values The default value is 1.0
      • hash_static

        public static long hash_static()
      • initWithCoderDevice

        public MPSNNOptimizer initWithCoderDevice​(NSCoder aDecoder,
                                                  java.lang.Object device)
        Description copied from class: MPSKernel
        NSSecureCoding compatability While the standard NSSecureCoding/NSCoding method -initWithCoder: should work, since the file can't know which device your data is allocated on, we have to guess and may guess incorrectly. To avoid that problem, use initWithCoder:device instead.
        Overrides:
        initWithCoderDevice in class MPSKernel
        Parameters:
        aDecoder - The NSCoder subclass with your serialized MPSKernel
        device - The MTLDevice on which to make the MPSKernel
        Returns:
        A new MPSKernel object, or nil if failure.
      • initWithDevice

        public MPSNNOptimizer initWithDevice​(java.lang.Object device)
        Description copied from class: MPSKernel
        Standard init with default properties per filter type
        Overrides:
        initWithDevice in class MPSKernel
        Parameters:
        device - The device that the filter will be used on. May not be NULL.
        Returns:
        a pointer to the newly initialized object. This will fail, returning nil if the device is not supported. Devices must be MTLFeatureSet_iOS_GPUFamily2_v1 or later.
      • 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)
      • learningRate

        public float learningRate()
        [@property] learningRate The learningRate at which we update values The default value is 1e-3
      • new_objc

        public static java.lang.Object new_objc()
      • regularizationScale

        public float regularizationScale()
        [@property] regularizationScale The regularizationScale at which we apply L1 or L2 regularization, it gets ignored if regularization is None The default value is 0.0
      • regularizationType

        public long regularizationType()
        [@property] regularizationType The regularizationType which we apply. The default value is MPSRegularizationTypeNone
      • resolveClassMethod

        public static boolean resolveClassMethod​(org.moe.natj.objc.SEL sel)
      • resolveInstanceMethod

        public static boolean resolveInstanceMethod​(org.moe.natj.objc.SEL sel)
      • setApplyGradientClipping

        public void setApplyGradientClipping​(boolean value)
        [@property] applyGradientClipping A bool which decides if gradient will be clipped The default value is NO
      • setLearningRate

        public void setLearningRate​(float newLearningRate)
      • 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: NSSecureCoding
        This 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:
        _supportsSecureCoding in interface NSSecureCoding
        Overrides:
        _supportsSecureCoding in class MPSKernel
      • version_static

        public static long version_static()