[关闭]
@EggGump 2018-09-06T23:43:37.000000Z 字数 465 阅读 681

tensorflow 学习率下降用法 tf.train.exponential_decay

tensorflow


  1. from ctypes import *
  2. import tensorflow as tf
  3. import matplotlib.pyplot as plt
  4. alpha = 0.1
  5. decay_rate = 0.96
  6. decay_step = 1000
  7. global_ = tf.Variable(tf.constant(0))
  8. global_step = 10000
  9. learn_rate = tf.train.exponential_decay(alpha,global_,decay_step,decay_rate,staircase=True)
  10. c = []
  11. with tf.Session() as sess:
  12. for i in range(global_step):
  13. tc = sess.run(learn_rate,feed_dict={global_:i})
  14. c.append(tc)
  15. plt.figure(1)
  16. plt.plot(range(global_step),c,'r-')
  17. plt.show()
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注