-\nabla_{\theta} f_t (\theta_{t-1})         \
      &\hspace{5mm}\textbf{else}
      \      &\hspace{10mm}g_t           \leftarrow   \nabla_{\theta}
      f_t (\theta_{t-1})          \      &\hspace{5mm}\textbf{if} \:
      \lambda \neq 0                                           \
      &\hspace{10mm} g_t \leftarrow g_t + \lambda  \theta_{t-1}
      \      &\hspace{5mm}m_t           \leftarrow   \beta_1 m_{t-1}
      + (1 - \beta_1) g_t          \      &\hspace{5mm}v_t
      \leftarrow   \beta_2 v_{t-1} + (1-\beta_2) g^2_t          \
      &\hspace{5mm}\widehat{m_t} \leftarrow   m_t/\big(1-\beta_1^t
      \big)                   \      &\hspace{5mm}\widehat{v_t}
      \leftarrow   v_t/\big(1-\beta_2^t \big)                   \
      &\hspace{5mm}\textbf{if} \: amsgrad
      \      &\hspace{10mm}\widehat{v_t}^{max} \leftarrow
      \mathrm{max}(\widehat{v_t}^{max},          \widehat{v_t})
      \      &\hspace{10mm}\theta_t \leftarrow \theta_{t-1} - \gamma