(features)
return example_serial
Creates an Example protocol buffer.

  Create a protocol buffer with an integer feature for the class label, and a
  bytes feature for the input (image or feature)

  Args:
    features: sequence of (key, feature_type, value) tuples. Features to encode
      in the Example. `key` corresponds to the feature name, `feature_type` can
      either be 'int64', 'float32', or 'bytes', and `value` corresponds to the
      feature itself.

  Returns:
    example_serial: A string corresponding to the serialized example.
Creates an Example protocol buffer.
Creates an Example protocol buffer .
def make_example(features):
  """Creates an Example protocol buffer.

  Create a protocol buffer with an integer feature for the class label, and a
  bytes feature for the input (image or feature)

  Args:
    features: sequence of (key, feature_type, value) tuples. Features to encode
      in the Example. `key` corresponds to the feature name, `feature_type` can
      either be 'int64', 'float32', or 'bytes', and `value` corresponds to the
      feature itself.

  Returns:
    example_serial: A string corresponding to the serialized example.

  """

  def _int64_feature(value):
    return tf.train.Feature(int64_list=tf.train.Int64List(value=value))

  def _float32_feature(value):
    return tf.train.Feature(float_list=tf.train.FloatList(value=value))

  def _bytes_feature(value):
    return tf.train.Feature(bytes_list=tf.train.BytesList(value=value))

  feature_fns = {
      'int64': _int64_feature,
      'float32': _float32_feature,
      'bytes': _bytes_feature
  }

  feature_dict = dict((key, feature_fns[feature_type](value))
                      for key, feature_type, value in features)

  # Create an example protocol buffer.
  example = tf.train.Example(features=tf.train.Features(feature=feature_dict))
  example_serial = example.SerializeToString()
  return example_serial
def make_example ( features ) : def _int64_feature ( value ) : return tf . train . Feature ( int64_list = tf . train . Int64List ( value = value ) ) def _float32_feature ( value ) : return tf . train . Feature ( float_list = tf . train . FloatList ( value = value ) ) def _bytes_feature ( value ) : return tf . train . Feature ( bytes_list = tf . train . BytesList ( value = value ) ) feature_fns = { 'int64' : _int64_feature , 'float32' : _float32_feature , 'bytes' : _bytes_feature } feature_dict = dict ( ( key , feature_fns [ feature_type ] ( value ) ) for key , feature_type , value in features ) # Create an example protocol buffer. example = tf . train . Example ( features = tf . train . Features ( feature = feature_dict ) ) example_serial = example . SerializeToString ( ) return example_serial