Tôi cung cấp dữ liệu cho biểu đồ với phương thức đường dẫn đầu vào và tf.train.shuffle_batch
được triển khai để tạo dữ liệu lô. Tuy nhiên, khi quá trình đào tạo diễn ra, lưu lượng trở nên chậm hơn và chậm hơn cho các lần lặp lại sau này. Tôi bối rối về lý do quan trọng dẫn đến nó là gì? Cảm ơn rất nhiều! Đoạn mã của tôi là:Đào tạo dòng chảy trở nên chậm hơn và chậm hơn khi lặp lại nhiều hơn 10.000. Tại sao?
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()
Thật khó để nói mà không nhìn thấy chương trình của bạn, nhưng tôi nghi ngờ rằng một cái gì đó trong vòng lặp đào tạo của bạn là thêm các nút để đồ thị. Nếu trường hợp này xảy ra, bạn cũng có thể bị rò rỉ bộ nhớ, vì vậy [tài liệu này] (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) có một kỹ thuật gỡ lỗi tiềm năng. – mrry
Âm thanh như một Shlemiel Thuật toán Painter. Bạn có perchance theo dõi một nơi nào khác siêu dữ liệu bằng cách thêm nó/concatenating nó vào một cấu trúc dữ liệu với O (n) chèn thời gian? –
Tôi đã đăng đoạn mã của tôi, cảm ơn bạn rất nhiều! – Lei