class_docstr: Dataset object to help manage the TFRecord loading.
docstr: 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".
code: 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}
  
file_path: magenta/magenta/models/nsynth/reader.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from magenta.models.nsynth import utils
  import numpy
  import tensorflow.compat.v1
label_desc: Use image node_id 3 for calling the NSynthDataset obj's underlying member method code with example usage: obj.get_wavenet_batch(batch_size, length) and returns: dict