当前位置: 首页>>代码示例>>Python>>正文


Python moving_averages.ExponentialMovingAverage方法代码示例

本文整理汇总了Python中tensorflow.python.training.moving_averages.ExponentialMovingAverage方法的典型用法代码示例。如果您正苦于以下问题:Python moving_averages.ExponentialMovingAverage方法的具体用法?Python moving_averages.ExponentialMovingAverage怎么用?Python moving_averages.ExponentialMovingAverage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tensorflow.python.training.moving_averages的用法示例。


在下文中一共展示了moving_averages.ExponentialMovingAverage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from tensorflow.python.training import moving_averages [as 别名]
# 或者: from tensorflow.python.training.moving_averages import ExponentialMovingAverage [as 别名]
def __init__(self, opt, average_decay=0.9999, num_updates=None,
               sequential_update=True):
    """Construct a new MovingAverageOptimizer.

    Args:
      opt: A tf.Optimizer that will be used to compute and apply gradients.
      average_decay: Float.  Decay to use to maintain the moving averages
                     of trained variables.
                     See tf.train.ExponentialMovingAverage for details.
      num_updates: Optional count of number of updates applied to variables.
                   See tf.train.ExponentialMovingAverage for details.
      sequential_update: Bool. If False, will compute the moving average at the
                         same time as the model is updated, potentially doing
                         benign data races.
                         If True, will update the moving average after gradient
                         updates.
    """
    self._optimizer = opt
    self._ema = moving_averages.ExponentialMovingAverage(
        average_decay, num_updates=num_updates)
    self._variable_map = None
    self._sequential_update = sequential_update 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:24,代码来源:moving_average_optimizer.py

示例2: __init__

# 需要导入模块: from tensorflow.python.training import moving_averages [as 别名]
# 或者: from tensorflow.python.training.moving_averages import ExponentialMovingAverage [as 别名]
def __init__(self, optimizer, begin_step, end_step, frequency,
               drop_fraction=0.1, drop_fraction_anneal='constant',
               use_locking=False, grow_init='zeros', momentum=0.9,
               use_tpu=False, name='SparseMomentumOptimizer',
               stateless_seed_offset=0):
    super(SparseMomentumOptimizer, self).__init__(
        optimizer, begin_step, end_step, frequency, drop_fraction=drop_fraction,
        drop_fraction_anneal=drop_fraction_anneal, grow_init=grow_init,
        use_locking=use_locking, name='SparseMomentumOptimizer',
        stateless_seed_offset=stateless_seed_offset)
    self._ema_grads = moving_averages.ExponentialMovingAverage(decay=momentum)
    self._use_tpu = use_tpu 
开发者ID:google-research,项目名称:rigl,代码行数:14,代码来源:sparse_optimizers.py


注:本文中的tensorflow.python.training.moving_averages.ExponentialMovingAverage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。