class_docstr: Progressive GAN model for a specific stage and batch_size.
class_docstr_tok: ["Progressive","GAN","model","for","a","specific","stage","and","batch_size","."]
docstr: Generate fake samples for given latents and pitches.
  
  Args:
    z: A numpy array of latent vectors [n_samples, n_latent dims].
    pitches: An iterable list of integer MIDI pitches [n_samples].
    max_audio_length: Integer, trim to this many samples.
  
  Returns:
    audio: Generated audio waveforms [n_samples, max_audio_length]
docstr_tok: ["Generate","fake","samples","for","given","latents","and","pitches",".","Args",":","z",":","A","numpy","array","of","latent","vectors","[","n_samples",",","n_latent","dims","]",".","pitches",":","An","iterable","list","of","integer","MIDI","pitches","[","n_samples","]",".","max_audio_length",":","Integer",",","trim","to","this","many","samples",".","Returns",":","audio",":","Generated","audio","waveforms","[","n_samples",",","max_audio_length","]"]
code: def generate_samples_from_z(self, z, pitches, max_audio_length=64000):
      """Generate fake samples for given latents and pitches.
  
      Args:
        z: A numpy array of latent vectors [n_samples, n_latent dims].
        pitches: An iterable list of integer MIDI pitches [n_samples].
        max_audio_length: Integer, trim to this many samples.
  
      Returns:
        audio: Generated audio waveforms [n_samples, max_audio_length]
      """
      labels = self._pitches_to_labels(pitches)
      n_samples = len(labels)
      num_batches = int(np.ceil(float(n_samples) / self.batch_size))
      n_tot = num_batches * self.batch_size
      padding = n_tot - n_samples
      # Pads zeros to make batches even batch size.
      labels = labels + [0] * padding
      z = np.concatenate([z, np.zeros([padding, z.shape[1]])], axis=0)
  
      # Generate waves
      start_time = time.time()
      waves_list = []
      for i in range(num_batches):
          start = i * self.batch_size
          end = (i + 1) * self.batch_size
  
          waves = self.sess.run(
              self.fake_waves_ph,
              feed_dict={
                  self.labels_ph: labels[start:end],
                  self.noises_ph: z[start:end],
              },
          )
          # Trim waves
          for wave in waves:
              waves_list.append(wave[:max_audio_length, 0])
  
      # Remove waves corresponding to the padded zeros.
      result = np.stack(waves_list[:n_samples], axis=0)
      print(
          "generate_samples: generated {} samples in {}s".format(
              n_samples, time.time() - start_time
          )
      )
      return result
  
imports: import json
  import os
  import time
  from magenta.models.gansynth.lib import data_helpers
  from magenta.models.gansynth.lib import flags
  from magenta.models.gansynth.lib import network_functions
  from magenta.models.gansynth.lib import networks
  from magenta.models.gansynth.lib import train_util
  from magenta.models.gansynth.lib import util
  import numpy
  import tensorflow.compat.v1
  import tensorflow_gan
label_desc: Use image node_id 7 for calling the Model obj's underlying member method code with example usage: obj.generate_samples_from_z(z, pitches, max_audio_length) and returns: result