1

TensorFlow 1.4 の新しい Dataset API の前は、次のコードを使用して、異なるワーカー間でファイル名の共有キューを作成していました。

# queue with the file names that can be shared amongst workers during training
filename_queue = tf.FIFOQueue(100, tf.string, shared_name=shared_name)
enque_op = filename_queue.enqueue_many([tf.train.limit_epochs(file_names, num_epochs)])
close_op = filename_queue.close(cancel_pending_enqueues=True)

# create queue runner and add it to queue runners
qr = tf.train.QueueRunner(filename_queue, [enque_op], close_op,
                          queue_closed_exception_types=(tf.errors.OutOfRangeError, tf.errors.CancelledError))
tf.train.add_queue_runner(qr)

# read example from file
reader = tf.TFRecordReader()
_, example = reader.read(filename_queue)

# parse example
image, ground_truth, example_name = parse_example(example)

このコードはキューとキュー ランナーを使用しており、非常に見苦しく、混乱を招きます。ただし、ワーカー間で共有キューを作成するオプションが許可されていたshared_name=ため、同じ例では機能しませんでした。

TensorFlow 1.4 の新しいリリース後、入力パイプラインはより使いやすくなりました。そのため、この新しい機能を使用するようにプログラムを更新したいと考えています。ただし、新しいドキュメントのどこにも、ワーカー間でデータセットを共有する方法が見つかりません。

これは自動的に行われますか、それとも機能ではありませんか?

4

1 に答える 1