def _predict_input_fn():
"""Supplies the input to the model.
Returns:
A tuple consisting of 1) a dictionary of tensors whose keys are
the feature names, and 2) a tensor of target labels if the mode
is not INFER (and None, otherwise).
"""
feature_spec = tf.contrib.layers.create_feature_spec_for_parsing(
feature_columns=_get_feature_columns(include_target_column=False))
feature_spec[FLAGS.id_field] = tf.FixedLenFeature([], dtype=tf.string)
feature_spec[FLAGS.target_field + "_string"] = tf.FixedLenFeature(
[], dtype=tf.string)
# Add a placeholder for the serialized tf.Example proto input.
examples = tf.placeholder(tf.string, shape=(None,), name="examples")
features = tf.parse_example(examples, feature_spec)
features[PREDICTION_KEY] = features[FLAGS.id_field]
inputs = {PREDICTION_EXAMPLES: examples}
return input_fn_utils.InputFnOps(
features=features, labels=None, default_inputs=inputs)
variants_inference.py 文件源码
python
阅读 26
收藏 0
点赞 0
评论 0
评论列表
文章目录