tensorflow之ExponentialMovingAverage(指數滑動平均)
來自專欄 Python及其庫
tensorflow官方文檔解釋
https://www.tensorflow.org/api_docs/python/tf/train/ExponentialMovingAverage關於ExponentialMovingAverage這個類的解釋如下截圖

- 作用
Maintains moving averages of variables by employing an exponential decay.
通過採用指數衰減保持滑動平均變數
- 原理
When training a model, it is often beneficial to maintain moving averages of the trained parameters. Evaluations that use averaged parameters sometimes produce significantly better results than the final trained values.
訓練模型時,保持訓練參數的滑動平均通常是有好處的。使用滑動平均參數的評估有時會比最終的訓練參數有更高的正確率
- 幾個函數
The
apply()method adds shadow copies of trained variables and add ops that maintain a moving average of the trained variables in their shadow copies. It is used when building the training model. The ops that maintain moving averages are typically run after each training step. Theaverage()andaverage_name()methods give access to the shadow variables and their names. They are useful when building an evaluation model, or when restoring a model from a checkpoint file. They help use the moving averages in place of the last trained values for evaluations.
apply()定義一個更新變數滑動平均的操作
average()獲取滑動平均之後變數的取值
average_name()獲取滑動平均之後變數的name
關於更具體的使用可以參考上面所給出的官方鏈接
推薦閱讀:
※1.4 卷積神經網路初探
※用tf.placeholder構建features, labels容器
※[乾貨|實踐] TensorBoard可視化
※五分鐘喝不完一杯咖啡,但五分鐘可以帶你入門TensorFlow
※深度卷積GAN之圖像生成
TAG:TensorFlow |
