(inputs, hparams)
return tf.train.Example(features=tf.train.Features(feature=feature))
Convert InputTensors to Example proto ready for serialization.
Convert InputTensors to Example proto ready for serialization.
Convert InputTensors to Example proto ready for serialization .
def input_tensors_to_example(inputs, hparams):
  """Convert InputTensors to Example proto ready for serialization."""
  del hparams

  feature = {
      'spec': tf.train.Feature(
          float_list=tf.train.FloatList(value=inputs.spec.flatten())),
      'spectrogram_hash': tf.train.Feature(
          int64_list=tf.train.Int64List(value=[inputs.spectrogram_hash])),
      'labels': tf.train.Feature(
          float_list=tf.train.FloatList(value=inputs.labels.flatten())),
      'label_weights': tf.train.Feature(
          float_list=tf.train.FloatList(value=inputs.label_weights.flatten())),
      'length': tf.train.Feature(
          int64_list=tf.train.Int64List(value=[inputs.length])),
      'onsets': tf.train.Feature(
          float_list=tf.train.FloatList(value=inputs.onsets.flatten())),
      'offsets': tf.train.Feature(
          float_list=tf.train.FloatList(value=inputs.offsets.flatten())),
      'velocities': tf.train.Feature(
          float_list=tf.train.FloatList(value=inputs.velocities.flatten())),
      'sequence_id': tf.train.Feature(
          bytes_list=tf.train.BytesList(value=[inputs.sequence_id])),
      'note_sequence': tf.train.Feature(
          bytes_list=tf.train.BytesList(value=[inputs.note_sequence])),
  }

  return tf.train.Example(features=tf.train.Features(feature=feature))
def input_tensors_to_example ( inputs , hparams ) : del hparams feature = { 'spec' : tf . train . Feature ( float_list = tf . train . FloatList ( value = inputs . spec . flatten ( ) ) ) , 'spectrogram_hash' : tf . train . Feature ( int64_list = tf . train . Int64List ( value = [ inputs . spectrogram_hash ] ) ) , 'labels' : tf . train . Feature ( float_list = tf . train . FloatList ( value = inputs . labels . flatten ( ) ) ) , 'label_weights' : tf . train . Feature ( float_list = tf . train . FloatList ( value = inputs . label_weights . flatten ( ) ) ) , 'length' : tf . train . Feature ( int64_list = tf . train . Int64List ( value = [ inputs . length ] ) ) , 'onsets' : tf . train . Feature ( float_list = tf . train . FloatList ( value = inputs . onsets . flatten ( ) ) ) , 'offsets' : tf . train . Feature ( float_list = tf . train . FloatList ( value = inputs . offsets . flatten ( ) ) ) , 'velocities' : tf . train . Feature ( float_list = tf . train . FloatList ( value = inputs . velocities . flatten ( ) ) ) , 'sequence_id' : tf . train . Feature ( bytes_list = tf . train . BytesList ( value = [ inputs . sequence_id ] ) ) , 'note_sequence' : tf . train . Feature ( bytes_list = tf . train . BytesList ( value = [ inputs . note_sequence ] ) ) , } return tf . train . Example ( features = tf . train . Features ( feature = feature ) )