tf.keras.backend.moving_average_update
bookmark_borderbookmark
Stay organized with collections
Save and categorize content based on your preferences.
Compute the exponential moving average of a value.
View aliases
Compat aliases for migration
See
Migration guide for
more details.
tf.compat.v1.keras.backend.moving_average_update
tf.keras.backend.moving_average_update(
x, value, momentum
)
The moving average 'x' is updated with 'value' following:
x = x * momentum + value * (1 - momentum)
For example:
x = tf.Variable(0.0)
momentum=0.9
moving_average_update(x, value = 2.0, momentum=momentum).numpy()
x.numpy()
0.2
The result will be biased towards the initial value of the variable.
If the variable was initialized to zero, you can divide by
1 - momentum ** num_updates
to debias it (Section 3 of
Kingma et al., 2015):
num_updates = 1.0
x_zdb = x/(1 - momentum**num_updates)
x_zdb.numpy()
2.0
Arguments |
x
|
A Variable, the moving average.
|
value
|
A tensor with the same shape as x , the new value to be
averaged in.
|
momentum
|
The moving average momentum.
|
Returns |
The updated variable.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2020-10-01 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2020-10-01 UTC."],[],[]]