class_docstr: Base class shared by Tacotron and Tacotron2
docstr: Compute masks  against sequence paddings.
docstr_tok: ["Compute","masks","against","sequence","paddings","."]
code: def compute_masks(self, text_lengths, mel_lengths):
      """Compute masks  against sequence paddings."""
      # B x T_in_max (boolean)
      input_mask = sequence_mask(text_lengths)
      output_mask = None
      if mel_lengths is not None:
          max_len = mel_lengths.max()
          r = self.decoder.r
          max_len = (
              max_len + (r - (max_len % r))
              if max_len % r > 0
              else max_len
          )
          output_mask = sequence_mask(mel_lengths, max_len=max_len)
      return input_mask, output_mask
  
imports: import copy
  from abc import abstractmethod
  from typing import Dict, Tuple
  import torch
  from coqpit import Coqpit
  from torch import nn
  from TTS.tts.layers.losses import TacotronLoss
  from TTS.tts.models.base_tts import BaseTTS
  from TTS.tts.utils.helpers import sequence_mask
  from TTS.tts.utils.speakers import SpeakerManager
  from TTS.tts.utils.synthesis import synthesis
  from TTS.tts.utils.text.tokenizer import TTSTokenizer
  from TTS.tts.utils.visual import plot_alignment, plot_spectrogram
  from TTS.utils.generic_utils import format_aux_input
  from TTS.utils.io import load_fsspec
  from TTS.utils.training import gradual_training_scheduler
label_desc: Use image node_id 12 for calling the BaseTacotron obj's underlying member method code with example usage: obj.compute_masks(text_lengths, mel_lengths) and returns: input_mask,  output_mask