code: def synthesis(
      model,
      text,
      CONFIG,
      use_cuda,
      ap,
      speaker_id=None,
      style_wav=None,
      truncated=False,
      enable_eos_bos_chars=False,  # pylint: disable=unused-argument
      use_griffin_lim=False,
      do_trim_silence=False,
      speaker_embedding=None,
      backend="torch",
  ):
      """Synthesize voice for the given text.
  
      Args:
          model (TTS.tts.models): model to synthesize.
          text (str): target text
          CONFIG (dict): config dictionary to be loaded from config.json.
          use_cuda (bool): enable cuda.
          ap (TTS.tts.utils.audio.AudioProcessor): audio processor to process
              model outputs.
          speaker_id (int): id of speaker
          style_wav (str): Uses for style embedding of GST.
          truncated (bool): keep model states after inference. It can be used
              for continuous inference at long texts.
          enable_eos_bos_chars (bool): enable special chars for end of sentence and start of sentence.
          do_trim_silence (bool): trim silence after synthesis.
          backend (str): tf or torch
      """
      # GST processing
      style_mel = None
      if (
          "use_gst" in CONFIG.keys()
          and CONFIG.use_gst
          and style_wav is not None
      ):
          if isinstance(style_wav, dict):
              style_mel = style_wav
          else:
              style_mel = compute_style_mel(
                  style_wav, ap, cuda=use_cuda
              )
      # preprocess the given text
      inputs = text_to_seqvec(text, CONFIG)
      # pass tensors to backend
      if backend == "torch":
          if speaker_id is not None:
              speaker_id = id_to_torch(speaker_id, cuda=use_cuda)
  
          if speaker_embedding is not None:
              speaker_embedding = embedding_to_torch(
                  speaker_embedding, cuda=use_cuda
              )
  
          if not isinstance(style_mel, dict):
              style_mel = numpy_to_torch(
                  style_mel, torch.float, cuda=use_cuda
              )
          inputs = numpy_to_torch(inputs, torch.long, cuda=use_cuda)
          inputs = inputs.unsqueeze(0)
      elif backend == "tf":
          # TODO: handle speaker id for tf model
          style_mel = numpy_to_tf(style_mel, tf.float32)
          inputs = numpy_to_tf(inputs, tf.int32)
          inputs = tf.expand_dims(inputs, 0)
      elif backend == "tflite":
          style_mel = numpy_to_tf(style_mel, tf.float32)
          inputs = numpy_to_tf(inputs, tf.int32)
          inputs = tf.expand_dims(inputs, 0)
      # synthesize voice
      if backend == "torch":
          (
              decoder_output,
              postnet_output,
              alignments,
              stop_tokens,
          ) = run_model_torch(
              model,
              inputs,
              CONFIG,
              truncated,
              speaker_id,
              style_mel,
              speaker_embeddings=speaker_embedding,
          )
          (
              postnet_output,
              decoder_output,
              alignment,
              stop_tokens,
          ) = parse_outputs_torch(
              postnet_output, decoder_output, alignments, stop_tokens
          )
      elif backend == "tf":
          (
              decoder_output,
              postnet_output,
              alignments,
              stop_tokens,
          ) = run_model_tf(
              model, inputs, CONFIG, truncated, speaker_id, style_mel
          )
          (
              postnet_output,
              decoder_output,
              alignment,
              stop_tokens,
          ) = parse_outputs_tf(
              postnet_output, decoder_output, alignments, stop_tokens
          )
      elif backend == "tflite":
          (
              decoder_output,
              postnet_output,
              alignment,
              stop_tokens,
          ) = run_model_tflite(
              model, inputs, CONFIG, truncated, speaker_id, style_mel
          )
          postnet_output, decoder_output = parse_outputs_tflite(
              postnet_output, decoder_output
          )
      # convert outputs to numpy
      # plot results
      wav = None
      if use_griffin_lim:
          wav = inv_spectrogram(postnet_output, ap, CONFIG)
          # trim silence
          if do_trim_silence:
              wav = trim_silence(wav, ap)
      return (
          wav,
          alignment,
          decoder_output,
          postnet_output,
          stop_tokens,
          inputs,
      )
  
file_path: TTS/TTS/tts/utils/synthesis.py
imports: import pkg_resources
  import torch
  import numpy
  from .text import text_to_sequence, phoneme_to_sequence
label_desc: Use image node_id 16 for calling a global function with example usage: synthesis(model, text, CONFIG, use_cuda, ap, speaker_id, style_wav, truncated, enable_eos_bos_chars, use_griffin_lim, do_trim_silence, speaker_embedding, backend) and returns: wav,  alignment,  decoder_output,  postnet_output,  stop_tokens,  inputs