Skip to content

Commit 0a43941

Browse files
committed
Corrected tf example to comply with tf 1.0.
1 parent 50a0acf commit 0a43941

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

examples/python/learning_tensorflow.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from __future__ import print_function
55
from vizdoom import *
66
import itertools as it
7-
import pickle
87
from random import sample, randint, random
98
from time import time, sleep
109
import numpy as np
@@ -215,7 +214,7 @@ def initialize_vizdoom(config_file_path):
215214
print("Loading model from: ", model_savefile)
216215
saver.restore(session, model_savefile)
217216
else:
218-
init = tf.initialize_all_variables()
217+
init = tf.global_variables_initializer()
219218
session.run(init)
220219
print("Starting the training!")
221220

@@ -228,7 +227,7 @@ def initialize_vizdoom(config_file_path):
228227

229228
print("Training...")
230229
game.new_episode()
231-
for learning_step in trange(learning_steps_per_epoch):
230+
for learning_step in trange(learning_steps_per_epoch, leave=False):
232231
perform_learning_step(epoch)
233232
if game.is_episode_finished():
234233
score = game.get_total_reward()
@@ -246,7 +245,7 @@ def initialize_vizdoom(config_file_path):
246245
print("\nTesting...")
247246
test_episode = []
248247
test_scores = []
249-
for test_episode in trange(test_episodes_per_epoch):
248+
for test_episode in trange(test_episodes_per_epoch, leave=False):
250249
game.new_episode()
251250
while not game.is_episode_finished():
252251
state = preprocess(game.get_state().screen_buffer)
@@ -263,7 +262,6 @@ def initialize_vizdoom(config_file_path):
263262

264263
print("Saving the network weigths to:", model_savefile)
265264
saver.save(session, model_savefile)
266-
# pickle.dump(get_all_param_values(net), open('weights.dump', "wb"))
267265

268266
print("Total elapsed time: %.2f minutes" % ((time() - time_start) / 60.0))
269267

0 commit comments

Comments
 (0)