(self, batch_size, length=64000)
return {"pitch": pitch, "wav": crop, "key": key}
Get the Tensor expressions from the reader.

    Args:
      batch_size: The integer batch size.
      length: Number of timesteps of a cropped sample to produce.

    Returns:
      A dict of key:tensor pairs. This includes "pitch", "wav", and "key".
Get the Tensor expressions from the reader.
Get the Tensor expressions from the reader .
def get_wavenet_batch(self, batch_size, length=64000):
    """Get the Tensor expressions from the reader.

    Args:
      batch_size: The integer batch size.
      length: Number of timesteps of a cropped sample to produce.

    Returns:
      A dict of key:tensor pairs. This includes "pitch", "wav", and "key".
    """
    example = self.get_example(batch_size)
    wav = example["audio"]
    wav = tf.slice(wav, [0], [64000])
    pitch = tf.squeeze(example["pitch"])
    key = tf.squeeze(example["note_str"])

    if self.is_training:
      # random crop
      crop = tf.random_crop(wav, [length])
      crop = tf.reshape(crop, [1, length])
      key, crop, pitch = tf.train.shuffle_batch(
          [key, crop, pitch],
          batch_size,
          num_threads=4,
          capacity=500 * batch_size,
          min_after_dequeue=200 * batch_size)
    else:
      # fixed center crop
      offset = (64000 - length) // 2  # 24320
      crop = tf.slice(wav, [offset], [length])
      crop = tf.reshape(crop, [1, length])
      key, crop, pitch = tf.train.shuffle_batch(
          [key, crop, pitch],
          batch_size,
          num_threads=4,
          capacity=500 * batch_size,
          min_after_dequeue=200 * batch_size)

    crop = tf.reshape(tf.cast(crop, tf.float32), [batch_size, length])
    pitch = tf.cast(pitch, tf.int32)
    return {"pitch": pitch, "wav": crop, "key": key}
def get_wavenet_batch ( self , batch_size , length = 64000 ) : example = self . get_example ( batch_size ) wav = example [ "audio" ] wav = tf . slice ( wav , [ 0 ] , [ 64000 ] ) pitch = tf . squeeze ( example [ "pitch" ] ) key = tf . squeeze ( example [ "note_str" ] ) if self . is_training : # random crop crop = tf . random_crop ( wav , [ length ] ) crop = tf . reshape ( crop , [ 1 , length ] ) key , crop , pitch = tf . train . shuffle_batch ( [ key , crop , pitch ] , batch_size , num_threads = 4 , capacity = 500 * batch_size , min_after_dequeue = 200 * batch_size ) else : # fixed center crop offset = ( 64000 - length ) // 2 # 24320 crop = tf . slice ( wav , [ offset ] , [ length ] ) crop = tf . reshape ( crop , [ 1 , length ] ) key , crop , pitch = tf . train . shuffle_batch ( [ key , crop , pitch ] , batch_size , num_threads = 4 , capacity = 500 * batch_size , min_after_dequeue = 200 * batch_size ) crop = tf . reshape ( tf . cast ( crop , tf . float32 ) , [ batch_size , length ] ) pitch = tf . cast ( pitch , tf . int32 ) return { "pitch" : pitch , "wav" : crop , "key" : key }