class_docstr: Class that manages the training loop. See speechbrain.core.Brain.
class_docstr_tok: ["Class","that","manages","the","training","loop",".","See","speechbrain.core.Brain","."]
docstr: Produces a sample in inference mode. This is called when producing
  samples.
docstr_tok: ["Produces","a","sample","in","inference","mode",".","This","is","called","when","producing","samples","."]
code: def run_inference_sample(self, name):
      """Produces a sample in inference mode. This is called when producing
      samples.
      """
      with torch.no_grad():
          if self.last_batch is None:
              return
          x, y = self.last_batch
  
          sig_out = self.modules.diffusion.inference(
              unconditional=self.hparams.unconditional,
              scale=self.hparams.spec_hop_length,
              condition=x,
              fast_sampling=self.hparams.fast_sampling,
              fast_sampling_noise_schedule=self.hparams.fast_sampling_noise_schedule,
          )
  
          spec_out = self.hparams.mel_spectogram(
              audio=sig_out.squeeze(1).cpu()
          )
  
      if self.hparams.use_tensorboard:
          self.tensorboard_logger.log_audio(
              f"{name}/audio_target",
              y.squeeze(0),
              self.hparams.sample_rate,
          )
          self.tensorboard_logger.log_audio(
              f"{name}/audio_pred",
              sig_out.squeeze(0),
              self.hparams.sample_rate,
          )
          self.tensorboard_logger.log_figure(f"{name}/mel_target", x)
          self.tensorboard_logger.log_figure(
              f"{name}/mel_pred", spec_out
          )
      else:
          # folder name is the current epoch for validation and "test" for test
          folder = (
              self.hparams.epoch_counter.current
              if name == "Valid"
              else "test"
          )
          self.save_audio("target", y.squeeze(1), folder)
          self.save_audio("synthesized", sig_out, folder)
  
file_path: speechbrain/recipes/LJSpeech/TTS/vocoder/diffwave/train.py
imports: import torchaudio
  import logging
  import sys
  import torch
  import speechbrain
  import os
  from hyperpyyaml import load_hyperpyyaml
label_desc: Use image node_id 6 for calling the DiffWaveBrain obj's underlying member method code with example usage: obj.run_inference_sample(name) without return types