class_docstr: General forward TTS model implementation that uses an encoder-decoder architecture with an optional alignment
  network and a pitch predictor.
  
  If the alignment network is used, the model learns the text-to-speech alignment
  from the data instead of using pre-computed durations.
  
  If the pitch predictor is used, the model trains a pitch predictor that predicts average pitch value for each
  input character as in the FastPitch model.
  
  `ForwardTTS` can be configured to one of these architectures,
  
      - FastPitch
      - SpeedySpeech
      - FastSpeech
      - FastSpeech2 (requires average speech energy predictor)
  
  Args:
      config (Coqpit): Model coqpit class.
      speaker_manager (SpeakerManager): Speaker manager for multi-speaker training. Only used for multi-speaker models.
          Defaults to None.
  
  Examples:
      >>> from TTS.tts.models.fast_pitch import ForwardTTS, ForwardTTSArgs
      >>> config = ForwardTTSArgs()
      >>> model = ForwardTTS(config)
class_docstr_tok: ["General","forward","TTS","model","implementation","that","uses","an","encoder-decoder","architecture","with","an","optional","alignment","network","and","a","pitch","predictor",".","If","the","alignment","network","is","used",",","the","model","learns","the","text-to-speech","alignment","from","the","data","instead","of","using","pre-computed","durations",".","If","the","pitch","predictor","is","used",",","the","model","trains","a","pitch","predictor","that","predicts","average","pitch","value","for","each","input","character","as","in","the","FastPitch","model",".","`","ForwardTTS","`","can","be","configured","to","one","of","these","architectures",",","-","FastPitch","-","SpeedySpeech","-","FastSpeech","-","FastSpeech2","(","requires","average","speech","energy","predictor",")","Args",":","config","(","Coqpit",")",":","Model","coqpit","class",".","speaker_manager","(","SpeakerManager",")",":","Speaker","manager","for","multi-speaker","training",".","Only","used","for","multi-speaker","models",".","Defaults","to","None",".","Examples",":",">",">",">","from","TTS.tts.models.fast_pitch","import","ForwardTTS",",","ForwardTTSArgs",">",">",">","config","=","ForwardTTSArgs","(",")",">",">",">","model","=","ForwardTTS","(","config",")"]
docstr: Create common logger outputs.
code: def _create_logs(self, batch, outputs, ap):
      """Create common logger outputs."""
      model_outputs = outputs["model_outputs"]
      alignments = outputs["alignments"]
      mel_input = batch["mel_input"]
  
      pred_spec = model_outputs[0].data.cpu().numpy()
      gt_spec = mel_input[0].data.cpu().numpy()
      align_img = alignments[0].data.cpu().numpy()
  
      figures = {
          "prediction": plot_spectrogram(
              pred_spec, ap, output_fig=False
          ),
          "ground_truth": plot_spectrogram(
              gt_spec, ap, output_fig=False
          ),
          "alignment": plot_alignment(align_img, output_fig=False),
      }
  
      # plot pitch figures
      if self.args.use_pitch:
          pitch_avg = abs(
              outputs["pitch_avg_gt"][0, 0].data.cpu().numpy()
          )
          pitch_avg_hat = abs(
              outputs["pitch_avg"][0, 0].data.cpu().numpy()
          )
          chars = self.tokenizer.decode(
              batch["text_input"][0].data.cpu().numpy()
          )
          pitch_figures = {
              "pitch_ground_truth": plot_avg_pitch(
                  pitch_avg, chars, output_fig=False
              ),
              "pitch_avg_predicted": plot_avg_pitch(
                  pitch_avg_hat, chars, output_fig=False
              ),
          }
          figures.update(pitch_figures)
  
      # plot energy figures
      if self.args.use_energy:
          energy_avg = abs(
              outputs["energy_avg_gt"][0, 0].data.cpu().numpy()
          )
          energy_avg_hat = abs(
              outputs["energy_avg"][0, 0].data.cpu().numpy()
          )
          chars = self.tokenizer.decode(
              batch["text_input"][0].data.cpu().numpy()
          )
          energy_figures = {
              "energy_ground_truth": plot_avg_energy(
                  energy_avg, chars, output_fig=False
              ),
              "energy_avg_predicted": plot_avg_energy(
                  energy_avg_hat, chars, output_fig=False
              ),
          }
          figures.update(energy_figures)
  
      # plot the attention mask computed from the predicted durations
      if "attn_durations" in outputs:
          alignments_hat = (
              outputs["attn_durations"][0].data.cpu().numpy()
          )
          figures["alignment_hat"] = plot_alignment(
              alignments_hat.T, output_fig=False
          )
  
      # Sample audio
      train_audio = ap.inv_melspectrogram(pred_spec.T)
      return figures, {"audio": train_audio}
  
imports: from dataclasses import dataclass, field
  from typing import Dict, List, Tuple, Union
  import torch
  from coqpit import Coqpit
  from torch import nn
  from torch.cuda.amp.autocast_mode import autocast
  from TTS.tts.layers.feed_forward.decoder import Decoder
  from TTS.tts.layers.feed_forward.encoder import Encoder
  from TTS.tts.layers.generic.aligner import AlignmentNetwork
  from TTS.tts.layers.generic.pos_encoding import PositionalEncoding
  from TTS.tts.layers.glow_tts.duration_predictor import DurationPredictor
  from TTS.tts.models.base_tts import BaseTTS
  from TTS.tts.utils.helpers import average_over_durations, generate_path, maximum_path, sequence_mask
  from TTS.tts.utils.speakers import SpeakerManager
  from TTS.tts.utils.text.tokenizer import TTSTokenizer
  from TTS.tts.utils.visual import plot_alignment, plot_avg_energy, plot_avg_pitch, plot_spectrogram
  from TTS.utils.io import load_fsspec
label_desc: Use image node_id 15 for calling the ForwardTTS obj's underlying member method code with example usage: obj._create_logs(batch, outputs, ap) and returns: figures,  dict