(example_id, ns, wav_data, velocity_range=None)
return example
Creates a tf.train.Example proto for training or testing.
Creates a tf.train.Example proto for training or testing.
Creates a tf . train . Example proto for training or testing .
def create_example(example_id, ns, wav_data, velocity_range=None):
  """Creates a tf.train.Example proto for training or testing."""
  if velocity_range is None:
    velocity_range = velocity_range_from_sequence(ns)

  # Ensure that all sequences for training and evaluation have gone through
  # sustain processing.
  sus_ns = sequences_lib.apply_sustain_control_changes(ns)

  example = tf.train.Example(
      features=tf.train.Features(
          feature={
              'id':
                  tf.train.Feature(
                      bytes_list=tf.train.BytesList(
                          value=[example_id.encode('utf-8')])),
              'sequence':
                  tf.train.Feature(
                      bytes_list=tf.train.BytesList(
                          value=[sus_ns.SerializeToString()])),
              'audio':
                  tf.train.Feature(
                      bytes_list=tf.train.BytesList(value=[wav_data])),
              'velocity_range':
                  tf.train.Feature(
                      bytes_list=tf.train.BytesList(
                          value=[velocity_range.SerializeToString()])),
          }))
  return example
def create_example ( example_id , ns , wav_data , velocity_range = None ) : if velocity_range is None : velocity_range = velocity_range_from_sequence ( ns ) # Ensure that all sequences for training and evaluation have gone through # sustain processing. sus_ns = sequences_lib . apply_sustain_control_changes ( ns ) example = tf . train . Example ( features = tf . train . Features ( feature = { 'id' : tf . train . Feature ( bytes_list = tf . train . BytesList ( value = [ example_id . encode ( 'utf-8' ) ] ) ) , 'sequence' : tf . train . Feature ( bytes_list = tf . train . BytesList ( value = [ sus_ns . SerializeToString ( ) ] ) ) , 'audio' : tf . train . Feature ( bytes_list = tf . train . BytesList ( value = [ wav_data ] ) ) , 'velocity_range' : tf . train . Feature ( bytes_list = tf . train . BytesList ( value = [ velocity_range . SerializeToString ( ) ] ) ) , } ) ) return example