ann_creation_helper.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:ChessAI 作者: SamRagusa 项目源码 文件源码
def serving_input_receiver_fn():
    """
    A function to use for input processing when serving the model.

    NOTES:
    1) This should still work, but I haven't tested it since using I think TensorFlow 1.2.1
    """
    feature_spec = {'str': tf.FixedLenFeature([1], tf.string)}
    serialized_tf_example = tf.placeholder(dtype=tf.string, name='input_example_tensor')

    receiver_tensors = {'example': serialized_tf_example}

    features = tf.parse_example(serialized_tf_example, feature_spec)

    # I could probably not do this and handle the data better within the graph
    features['str'] = tf.reshape(features['str'], [-1])

    data = full_onehot_process_line_as_2d_input(features['str'])

    return tf.estimator.export.ServingInputReceiver(data, receiver_tensors)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号