2017-01-18 22 views
0

我正在通過這些tensorflow codes實現張量流中的LSTM。在通過代碼時,我遇到了這個函數(在input_fn code-第38行)tf.contrib.learn.read_batch_features。我查閱了tf.contrib.learn.read_batch_featureshere的文檔。這是我得到 -tf.contrib.learn.read_batch_features的輸入參數

 
file_pattern: List of files or pattern of file paths containing Example records. 
batch_size: An int or scalar Tensor specifying the batch size to use. 
features: A dict mapping feature keys to FixedLenFeature or VarLenFeature values. 
randomize_input: Whether the input should be randomized. 
num_epochs: Integer specifying the number of times to read through the dataset. If None, cycles through the dataset forever. NOTE - If specified, creates a variable that must be initialized, so call tf.local_variables_initializer() as shown in the tests. 
queue_capacity: Capacity for input queue. 
reader_num_threads: The number of threads to read examples. 
name: Name of resulting op. 

有幾個輸入參數,我無法理解,並希望有人可以幫助我。

  1. randomize_input參數。這是否意味着它會洗牌整個數據集?

  2. 對於num_epochs,如果我指定None是否意味着我的input_fn將保持供給到model_fn。在那種情況下,培訓不會停止。這對我沒有意義。我想我在這裏的某處出錯了。

  3. queue_capacity我不知道這意味着什麼

將不勝感激圍繞着這些問題的任何幫助。提前致謝!

回答

1

randomize_input意味着文件名是隨機的,而且洗牌隊列用於在內存中洗牌一次。

對於num_epochs,由於其他原因(通常在給定的global_step停止訓練,無論輸入功能如何)可以停止訓練。

對於queue_capacity,TensorFlow內部使用隊列緩衝I/O以獲得最大吞吐量。該參數允許您控制該隊列的大小。