吴裕雄 PYTHON 神经网络——TENSORFLOW 学习率的设置
import tensorflow as tf
TRAINING_STEPS = 10
LEARNING_RATE = 1
x = tf.Variable(tf.constant(5, dtype=tf.float32), name="x")
y = tf.square(x) train_op = tf.train.GradientDescentOptimizer(LEARNING_RATE).minimize(y) with tf.Session() as sess:
sess.run(tf.global_variables_initializer())
for i in range(TRAINING_STEPS):
sess.run(train_op)
x_value = sess.run(x)
print( "After %s iteration(s): x%s is %f."% (i+1, i+1, x_value) )

TRAINING_STEPS = 1000
LEARNING_RATE = 0.001
x = tf.Variable(tf.constant(5, dtype=tf.float32), name="x")
y = tf.square(x) train_op = tf.train.GradientDescentOptimizer(LEARNING_RATE).minimize(y) with tf.Session() as sess:
sess.run(tf.global_variables_initializer())
for i in range(TRAINING_STEPS):
sess.run(train_op)
if i % 100 == 0:
x_value = sess.run(x)
print("After %s iteration(s): x%s is %f."% (i+1, i+1, x_value))

TRAINING_STEPS = 100
global_step = tf.Variable(0)
LEARNING_RATE = tf.train.exponential_decay(0.1, global_step, 1, 0.96, staircase=True) x = tf.Variable(tf.constant(5, dtype=tf.float32), name="x")
y = tf.square(x)
train_op = tf.train.GradientDescentOptimizer(LEARNING_RATE).minimize(y, global_step=global_step) with tf.Session() as sess:
sess.run(tf.global_variables_initializer())
for i in range(TRAINING_STEPS):
sess.run(train_op)
if i % 10 == 0:
LEARNING_RATE_value = sess.run(LEARNING_RATE)
x_value = sess.run(x)
print ("After %s iteration(s): x%s is %f, learning rate is %f."% (i+1, i+1, x_value, LEARNING_RATE_value))

吴裕雄 PYTHON 神经网络——TENSORFLOW 学习率的设置的更多相关文章
- 吴裕雄 python 神经网络——TensorFlow训练神经网络:不使用指数衰减的学习率
import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data INPUT_NODE = 784 ...
- 吴裕雄 python 神经网络——TensorFlow 循环神经网络处理MNIST手写数字数据集
#加载TF并导入数据集 import tensorflow as tf from tensorflow.contrib import rnn from tensorflow.examples.tuto ...
- 吴裕雄 python 神经网络——TensorFlow训练神经网络:不使用滑动平均
import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data INPUT_NODE = 784 ...
- 吴裕雄 python 神经网络——TensorFlow训练神经网络:不使用隐藏层
import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data INPUT_NODE = 784 ...
- 吴裕雄 python 神经网络——TensorFlow训练神经网络:不使用激活函数
import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data INPUT_NODE = 784 ...
- 吴裕雄 python 神经网络——TensorFlow训练神经网络:不使用正则化
import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data INPUT_NODE = 784 ...
- 吴裕雄 python 神经网络——TensorFlow训练神经网络:全模型
import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data INPUT_NODE = 784 ...
- 吴裕雄 PYTHON 神经网络——TENSORFLOW 无监督学习处理MNIST手写数字数据集
# 导入模块 import numpy as np import tensorflow as tf import matplotlib.pyplot as plt # 加载数据 from tensor ...
- 吴裕雄 python 神经网络——TensorFlow 使用卷积神经网络训练和预测MNIST手写数据集
import tensorflow as tf import numpy as np from tensorflow.examples.tutorials.mnist import input_dat ...
随机推荐
- Java引擎
import java.io.FileNotFoundException; import java.io.FileReader; import java.util.List; import javax ...
- codeforces E. The Contest(最长上升子序列)
题目链接:https://codeforces.com/contest/1257/problem/E 题意:给三个序列k1,k2,k3,每个序列有一堆数,k1是前缀,k3是后缀,k2是中间,现可以从任 ...
- 关于video++,jsrun,有道笔记等的感想
这几天一直在思考切入点.想了很多,有关于给初创企业提供社交平台营销的,如公众号,小程序,支付宝的到位,附近等.这些初看起来可行,细想起来有一些根本不完备.如通过微小宝多平台客户端了解最热的内容,在内容 ...
- git上传时出现ERROR: Repository not found.的解决办法
今天在上传时出现错误,原因是之前更改了gitee上的个人空间地址,导致找不到.需要重新配置 https://gitee.com/help/articles/4114#article-header0
- mongo日常命令集锦
查询某个字段是否存在 db.student.findOne({name:{$exists:true}}) db.student.findOne({'department.name':{$exists: ...
- if a != None:
>>> x = 1 >>> not x False >>> x = [1] >>> not x False >>&g ...
- 1.2 Jmeter 使用代理录制脚本
参考文档: http://jingyan.baidu.com/article/4e5b3e19333ff191911e2459.html 利用JMeter配置代理:1.添加线程组: Test Pla ...
- Linux下调试caffe
参考博客:https://blog.csdn.net/xiaoyezi_1834/article/details/50724875 使用Anjuta 我使用的是ubuntu18.04,安装命令: su ...
- glog与gflags的windows编译
参考博客:https://kezunlin.me/post/bb64e398/
- [python] VSCode+Jupyter 安装步骤以及注意事项
1. 安装Python2. 安装Jupyter, pip install 安装Jupyter(若使用Anaconda,则需要将其添加到环境变量中)3. 将Python的Scripts文件夹添加到系统环 ...