optimizer.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:tefla 作者: openAGI 项目源码 文件源码
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 = tf.train.ExponentialMovingAverage(
            average_decay, num_updates=num_updates)
        self._variable_map = None
        self._sequential_update = sequential_update
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号