擅长:python、mysql、java
<p>如果直接从主分支使用tensorflow,则有一个模块tensorflow.python.estimator.export提供了一个函数:</p>
<pre><code>from tensorflow.python.estimator.export import export
feature_spec = {'MY_FEATURE': tf.constant(2.0, shape=[1, 1])}
serving_input_fn = export.build_raw_serving_input_receiver_fn(feature_spec)
</code></pre>
<p>不幸的是,至少对我来说,它不会走得更远,但我不确定我的模型是否真的正确,所以也许你比我幸运。</p>
<p>或者,对于从pypi安装的当前版本,有以下函数:</p>
<pre><code>serving_input_fn = tf.contrib.learn.utils.build_parsing_serving_input_fn(feature_spec)
serving_input_fn = tf.contrib.learn.utils.build_default_serving_input_fn(feature_spec)
</code></pre>
<p>但我也不能让他们工作。</p>
<p>可能,我不太明白,所以我希望你会有更多的运气。</p>
<p>克里斯</p>