【发布时间】:2017-08-05 04:10:50
【问题描述】:
我在 TF 上使用高级 Estimator:
estim = tf.contrib.learn.Estimator(...)
estim.fit ( some_input )
如果 some_input 具有 x、y 和 batch_size,则代码运行但带有警告;所以我尝试使用input_fn,并设法通过这个input_fn发送x,y,但没有发送batch_size。没有找到任何例子。
谁能分享一个使用input_fn 作为estim.fit / estim.evaluate 的输入并同时使用batch_size 的简单示例?
我必须使用tf.train.batch吗?如果是这样,它如何合并到更高级别的实现中(tf.layers) - 我不知道图的 tf.Graph() 或会话?
以下是我收到的警告:
警告:tensorflow:来自/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/monitors.py:657:调用评估
(来自 tensorflow.contrib.learn.python.learn.estimators.estimator)带 y 已被弃用,并将在 2016-12-01 之后删除。
更新说明: 通过移动到 Estimator 与 Scikit Learn 界面分离 单独的类 SKCompat。参数 x、y 和 batch_size 仅 在 SKCompat 类中可用,Estimator 将只接受 input_fn。
转换示例:
est = Estimator(...) -> est = SKCompat(Estimator(...))
【问题讨论】:
-
对于将来可能会遇到 input_fn 问题的任何人(目前我发现文档不是很容易解释) - 找到了一个很好解释的例子,在以下link.
标签: python tensorflow