What is the capacity argument for tf.train.string_input_producer ()

The capacity argument of tf.train.string_input_producer(string_tensor, num_epochs=None, shuffle=True, seed=None, capacity=32, shared_name=None, name=None) is pretty vague for me.

What does it mean to set the capacity argument here, does it have anything to do with the length of the string_tensor argument. An example would be great. Thank you very much.

+3
source share
2 answers

Capacity is the size of the queue, so in your example, the queue runner can queue up to 32 lines in the queue

+3
source

Capacity for string_input_producer is the maximum number of elements that the queue can hold at any given time. You must set the number high enough so that your model does not go hungry due to insufficient data. But if you set the value too high, the queue will consume too much memory.

The best number depends on the model, and you can find it by trial and error. Start with a fairly small number and see how often your queue is empty. Increase the buffer until you see an empty queue.

0
source

Source: https://habr.com/ru/post/1238716/


All Articles