MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / adam_update_numpy

Function adam_update_numpy

tensorflow/compiler/tests/adam_test.py:34–49  ·  view source on GitHub ↗
(param,
                      g_t,
                      t,
                      m,
                      v,
                      alpha=0.001,
                      beta1=0.9,
                      beta2=0.999,
                      epsilon=1e-8)

Source from the content-addressed store, hash-verified

32
33
34def adam_update_numpy(param,
35 g_t,
36 t,
37 m,
38 v,
39 alpha=0.001,
40 beta1=0.9,
41 beta2=0.999,
42 epsilon=1e-8):
43 alpha_t = alpha * np.sqrt(1 - beta2**t) / (1 - beta1**t)
44
45 m_t = beta1 * m + (1 - beta1) * g_t
46 v_t = beta2 * v + (1 - beta2) * g_t * g_t
47
48 param_t = param - alpha_t * m_t / (np.sqrt(v_t) + epsilon)
49 return param_t, m_t, v_t
50
51
52class AdamOptimizerTest(xla_test.XLATestCase):

Callers 3

testBasicMethod · 0.70
testSharingMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected