2016-09-18 42 views
0

我有一个自定义输入功能,如下所示:为什么tf.train.batch只返回一批功能?

def my_input_fn(): 
    # parse a file and create a dictionary of features 
    return features 

此功能传递给tf.contrib.learn.Estimator.predict功能input_fn PARAM。我想以不同批次传递我的数据。搜索后,它似乎是tf.train.batch的责任。所以,我的编辑功能如下:

def my_input_fn(): 
    # parse a file and create a dictionary of features 
    return tf.learn.batch(tensors=features, batch_size=100, enqueue_many=True) 

问题是呼吁predict(input_fn=my_input_fn)只适用于一批100例返回估算结果。我如何设计my_input_fn函数来批量返回所有数据?

回答

0

对于潜在的读者:

  • 设置as_iterable=True解决问题。