Update to 1.0.0 · XRayCheng/tensorflow-tutorial@35aa1ae · GitHub
Skip to content

Commit 35aa1ae

Browse files
committed
Update to 1.0.0
1 parent 0393e48 commit 35aa1ae

6 files changed

Lines changed: 16 additions & 23 deletions

File tree

Deep_Learning_with_TensorFlow/0.12.0/Chapter10/4. 异步更新模式样例程序.py

Lines changed: 3 additions & 5 deletions

Deep_Learning_with_TensorFlow/0.12.0/Chapter10/5. 同步更新模式样例程序.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
TRAINING_STEPS = 10000
1414
MOVING_AVERAGE_DECAY = 0.99
1515
MODEL_SAVE_PATH = "logs/log_sync"
16-
DATA_PATH = "../../Data_sets/MNIST_data"
16+
DATA_PATH = "../../datasets/MNIST_data"
1717

1818

1919
# 和异步模式类似的设置flags。

Deep_Learning_with_TensorFlow/0.12.1/Chapter10/4. 异步更新模式样例程序.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
# 模型保存的路径和文件名。
1717
MODEL_SAVE_PATH = "logs/log_async"
18-
DATA_PATH = "../../Datasets/MNIST_data"
18+
DATA_PATH = "../../datasets/MNIST_data"
1919

2020
FLAGS = tf.app.flags.FLAGS
2121

@@ -40,7 +40,7 @@ def build_model(x, y_, is_chief):
4040
global_step = tf.Variable(0, trainable=False)
4141

4242
# 计算损失函数并定义反向传播过程。
43-
cross_entropy = tf.nn.sparse_softmax_cross_entropy_with_logits(y, tf.argmax(y_, 1))
43+
cross_entropy = tf.nn.sparse_softmax_cross_entropy_with_logits(logits=y, labels=tf.argmax(y_, 1))
4444
cross_entropy_mean = tf.reduce_mean(cross_entropy)
4545
loss = cross_entropy_mean + tf.add_n(tf.get_collection('losses'))
4646
learning_rate = tf.train.exponential_decay(
@@ -89,22 +89,20 @@ def main(argv=None):
8989
summary_op = tf.summary.merge_all()
9090
# 定义变量初始化操作。
9191
init_op = tf.global_variables_initializer()
92-
summary_writer = tf.summary.FileWriter
9392
# 通过tf.train.Supervisor管理训练深度学习模型时的通用功能。
9493
sv = tf.train.Supervisor(
9594
is_chief=is_chief,
9695
logdir=MODEL_SAVE_PATH,
9796
init_op=init_op,
9897
summary_op=summary_op,
9998
saver=saver,
100-
summary_writer=tf.summary.FileWriter
10199
global_step=global_step,
102100
save_model_secs=60,
103101
save_summaries_secs=60)
104102

105103
sess_config = tf.ConfigProto(allow_soft_placement=True, log_device_placement=False)
106104
# 通过tf.train.Supervisor生成会话。
107-
sess = sv.prepare_or_wait_for_session(server.target, config=sess_config) ###stucked####
105+
sess = sv.prepare_or_wait_for_session(server.target, config=sess_config)
108106

109107
step = 0
110108
start_time = time.time()

Deep_Learning_with_TensorFlow/0.12.1/Chapter10/5. 同步更新模式样例程序.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
TRAINING_STEPS = 10000
1414
MOVING_AVERAGE_DECAY = 0.99
1515
MODEL_SAVE_PATH = "logs/log_sync"
16-
DATA_PATH = "../../Datasets/MNIST_data"
16+
DATA_PATH = "../../datasets/MNIST_data"
1717

1818

1919
# 和异步模式类似的设置flags。

Deep_Learning_with_TensorFlow/1.0.0/Chapter10/4. 异步更新模式样例程序.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
MOVING_AVERAGE_DECAY = 0.99
1515

1616
# 模型保存的路径和文件名。
17-
MODEL_SAVE_PATH = "/Users/ymx/Desktop/MNIST_data/log"
18-
DATA_PATH = "/Users/ymx/Desktop/MNIST_data/data"
17+
MODEL_SAVE_PATH = "logs/log_async"
18+
DATA_PATH = "../../datasets/MNIST_data"
1919

2020
FLAGS = tf.app.flags.FLAGS
2121

@@ -40,7 +40,7 @@ def build_model(x, y_, is_chief):
4040
global_step = tf.Variable(0, trainable=False)
4141

4242
# 计算损失函数并定义反向传播过程。
43-
cross_entropy = tf.nn.sparse_softmax_cross_entropy_with_logits(y, tf.argmax(y_, 1))
43+
cross_entropy = tf.nn.sparse_softmax_cross_entropy_with_logits(logits=y, labels=tf.argmax(y_, 1))
4444
cross_entropy_mean = tf.reduce_mean(cross_entropy)
4545
loss = cross_entropy_mean + tf.add_n(tf.get_collection('losses'))
4646
learning_rate = tf.train.exponential_decay(
@@ -89,22 +89,20 @@ def main(argv=None):
8989
summary_op = tf.summary.merge_all()
9090
# 定义变量初始化操作。
9191
init_op = tf.global_variables_initializer()
92-
summary_writer = tf.summary.FileWriter
9392
# 通过tf.train.Supervisor管理训练深度学习模型时的通用功能。
9493
sv = tf.train.Supervisor(
9594
is_chief=is_chief,
9695
logdir=MODEL_SAVE_PATH,
9796
init_op=init_op,
9897
summary_op=summary_op,
9998
saver=saver,
100-
summary_writer=tf.summary.FileWriter
10199
global_step=global_step,
102100
save_model_secs=60,
103101
save_summaries_secs=60)
104102

105103
sess_config = tf.ConfigProto(allow_soft_placement=True, log_device_placement=False)
106104
# 通过tf.train.Supervisor生成会话。
107-
sess = sv.prepare_or_wait_for_session(server.target, config=sess_config) ###stucked####
105+
sess = sv.prepare_or_wait_for_session(server.target, config=sess_config)
108106

109107
step = 0
110108
start_time = time.time()

Deep_Learning_with_TensorFlow/1.0.0/Chapter10/5. 同步更新模式样例程序.py

Lines changed: 4 additions & 5 deletions

0 commit comments

Comments
 (0)