Przesyłam dane do wykresu metodami potoku wejściowego, a do generowania danych wsadowych zaimplementowano tf.train.shuffle_batch
. Jednak wraz z postępem treningu, tensorflow staje się wolniejszy i wolniejszy dla późniejszych iteracji. Nie rozumiem, jaki jest główny powód, który do tego doprowadził? Dziękuję bardzo! Mój fragment kodu to:Trening Tensorflow staje się wolniejszy i wolniejszy, gdy liczba powtórzeń przekracza 10.000. Czemu?
def main(argv=None):
# define network parameters
# weights
# bias
# define graph
# graph network
# define loss and optimization method
# data = inputpipeline('*')
# loss
# optimizer
# Initializaing the variables
init = tf.initialize_all_variables()
# 'Saver' op to save and restore all the variables
saver = tf.train.Saver()
# Running session
print "Starting session... "
with tf.Session() as sess:
# initialize the variables
sess.run(init)
# initialize the queue threads to start to shovel data
coord = tf.train.Coordinator()
threads = tf.train.start_queue_runners(coord=coord)
print "from the train set:"
for i in range(train_set_size * epoch):
_, d, pre = sess.run([optimizer, depth_loss, prediction])
print "Training Finished!"
# Save the variables to disk.
save_path = saver.save(sess, model_path)
print("Model saved in file: %s" % save_path)
# stop our queue threads and properly close the session
coord.request_stop()
coord.join(threads)
sess.close()
Trudno powiedzieć, nie widząc swój program, ale podejrzewam, że coś w pętli szkolenia jest dodanie węzłów do wykresu. Jeśli tak jest, możesz również cierpieć na wyciek pamięci, więc [ta dokumentacja] (http://stackoverflow.com/documentation/tensorflow/3883/how-to-debug-a-memory-leak-in- tensorflow/13426/use-graph-finalize-to-catch-nodes-being-added-to-the-graph # t = 201612280201558374055) ma potencjalną technikę debugowania. – mrry
Brzmi jak algorytm Shlemiela The Painter. Czy śledzisz gdzie indziej inne metadane, dołączając je/łącząc je ze strukturą danych za pomocą O (n) insert time? The –
Mam opublikować mój fragment kodu, dziękuję bardzo! – Lei