(
    input_example, preprocess_example_fn, input_tensors_to_example_fn, hparams,
    process_for_training)
return example
Preprocess example using data.preprocess_data.
Preprocess example using data.preprocess_data.
Preprocess example using data . preprocess_data .
def preprocess_data(
    input_example, preprocess_example_fn, input_tensors_to_example_fn, hparams,
    process_for_training):
  """Preprocess example using data.preprocess_data."""
  with tf.Graph().as_default():
    example_proto = tf.constant(input_example.SerializeToString())

    input_tensors = preprocess_example_fn(
        example_proto=example_proto, hparams=hparams,
        is_training=process_for_training)

    with tf.Session() as sess:
      preprocessed = sess.run(input_tensors)

  example = input_tensors_to_example_fn(preprocessed, hparams)
  Metrics.counter('preprocess_data', 'preprocess_example').inc()
  return example
def preprocess_data ( input_example , preprocess_example_fn , input_tensors_to_example_fn , hparams , process_for_training ) : with tf . Graph ( ) . as_default ( ) : example_proto = tf . constant ( input_example . SerializeToString ( ) ) input_tensors = preprocess_example_fn ( example_proto = example_proto , hparams = hparams , is_training = process_for_training ) with tf . Session ( ) as sess : preprocessed = sess . run ( input_tensors ) example = input_tensors_to_example_fn ( preprocessed , hparams ) Metrics . counter ( 'preprocess_data' , 'preprocess_example' ) . inc ( ) return example