#NEWLINE# def __init__( self , wrt , fprime , step_rate = 0.0002 , decay = ( 1 - 1e-08 ) , decay_mom1 = 0.1 , decay_mom2 = 0.001 , momentum = 0 , offset = 1e-08 , args = None ) : #NEWLINE# #INDENT# 'Create an Adam object.\n\n        Parameters\n        ----------\n\n        wrt : array_like\n            Array that represents the solution. Will be operated upon in\n            place.  ``fprime`` should accept this array as a first argument.\n\n        fprime : callable\n            Callable that given a solution vector as first parameter and *args\n            and **kwargs drawn from the iterations ``args`` returns a\n            search direction, such as a gradient.\n\n        step_rate : scalar or array_like, optional [default: 1]\n            Value to multiply steps with before they are applied to the\n            parameter vector.\n\n        decay : float, optional [default: 1e-8]\n            Decay parameter for the moving average. Must lie in [0, 1) where\n            lower numbers means a shorter "memory".\n\n        decay_mom1 : float, optional, [default: 0.1]\n            Decay parameter for the exponential moving average estimate of the\n            first moment.\n\n        decay_mom2 : float, optional, [default: 0.001]\n            Decay parameter for the exponential moving average estimate of the\n            second moment.\n\n        momentum : float or array_like, optional [default: 0]\n          Momentum to use during optimization. Can be specified analoguously\n          (but independent of) step rate.\n\n        offset : float, optional, [default: 1e-8]\n            Before taking the square root of the running averages, this offset\n            is added.\n\n        args : iterable\n            Iterator over arguments which ``fprime`` will be called with.\n        ' #NEWLINE# if ( not ( 0 < decay < 1 ) ) : #NEWLINE# #INDENT# raise ValueError ( 'decay has to lie in (0, 1)' ) #NEWLINE# #UNINDENT# if ( not ( 0 < decay_mom1 <= 1 ) ) : #NEWLINE# #INDENT# raise ValueError ( 'decay_mom1 has to lie in (0, 1]' ) #NEWLINE# #UNINDENT# if ( not ( 0 < decay_mom2 <= 1 ) ) : #NEWLINE# #INDENT# raise ValueError ( 'decay_mom2 has to lie in (0, 1]' ) #NEWLINE# #UNINDENT# if ( not ( ( ( 1 - ( decay_mom1 * 2 ) ) / ( ( 1 - decay_mom2 ) ** 0.5 ) ) < 1 ) ) : #NEWLINE# #INDENT# warnings . warn ( 'constraint from convergence analysis for adam not satisfied; check original paper to see if you really want to do this.' ) #NEWLINE# #UNINDENT# super ( Adam , self ) . __init__ ( wrt , args = args ) #NEWLINE# self . fprime = fprime #NEWLINE# self . step_rate = step_rate #NEWLINE# self . decay = decay #NEWLINE# self . decay_mom1 = decay_mom1 #NEWLINE# self . decay_mom2 = decay_mom2 #NEWLINE# self . offset = offset #NEWLINE# self . momentum = momentum #NEWLINE# self . est_mom1 = 0 #NEWLINE# self . est_mom2 = 0 #NEWLINE# self . est_mom1_b = 0 #NEWLINE# self . est_mom2_b = 0 #NEWLINE# self . step = 0