class_docstr: VC Tacotron2 module for VC.
  
  This is a module of Tacotron2-based VC model,
  which convert the sequence of acoustic features
  into the sequence of acoustic features.
docstr: Calculate all of the attention weights.
  
  Args:
      xs (Tensor): Batch of padded acoustic features (B, Tmax, idim).
      ilens (LongTensor): Batch of lengths of each input batch (B,).
      ys (Tensor): Batch of padded target features (B, Lmax, odim).
      olens (LongTensor): Batch of the lengths of each target (B,).
      spembs (Tensor, optional):
          Batch of speaker embedding vectors (B, spk_embed_dim).
  
  Returns:
      numpy.ndarray: Batch of attention weights (B, Lmax, Tmax).
docstr_tok: ["Calculate","all","of","the","attention","weights",".","Args",":","xs","(","Tensor",")",":","Batch","of","padded","acoustic","features","(","B",",","Tmax",",","idim",")",".","ilens","(","LongTensor",")",":","Batch","of","lengths","of","each","input","batch","(","B",",",")",".","ys","(","Tensor",")",":","Batch","of","padded","target","features","(","B",",","Lmax",",","odim",")",".","olens","(","LongTensor",")",":","Batch","of","the","lengths","of","each","target","(","B",",",")",".","spembs","(","Tensor",",","optional",")",":","Batch","of","speaker","embedding","vectors","(","B",",","spk_embed_dim",")",".","Returns",":","numpy.ndarray",":","Batch","of","attention","weights","(","B",",","Lmax",",","Tmax",")","."]
code: def calculate_all_attentions(
      self, xs, ilens, ys, spembs=None, *args, **kwargs
  ):
      """Calculate all of the attention weights.
  
      Args:
          xs (Tensor): Batch of padded acoustic features (B, Tmax, idim).
          ilens (LongTensor): Batch of lengths of each input batch (B,).
          ys (Tensor): Batch of padded target features (B, Lmax, odim).
          olens (LongTensor): Batch of the lengths of each target (B,).
          spembs (Tensor, optional):
              Batch of speaker embedding vectors (B, spk_embed_dim).
  
      Returns:
          numpy.ndarray: Batch of attention weights (B, Lmax, Tmax).
  
      """
      # check ilens type (should be list of int)
      if isinstance(ilens, torch.Tensor) or isinstance(
          ilens, np.ndarray
      ):
          ilens = list(map(int, ilens))
  
      self.eval()
      with torch.no_grad():
          # thin out input frames for reduction factor
          # (B, Lmax, idim) ->  (B, Lmax // r, idim * r)
          if self.encoder_reduction_factor > 1:
              B, Lmax, idim = xs.shape
              if Lmax % self.encoder_reduction_factor != 0:
                  xs = xs[
                      :, : -(Lmax % self.encoder_reduction_factor), :
                  ]
              xs_ds = xs.contiguous().view(
                  B,
                  int(Lmax / self.encoder_reduction_factor),
                  idim * self.encoder_reduction_factor,
              )
              ilens_ds = [
                  ilen // self.encoder_reduction_factor
                  for ilen in ilens
              ]
          else:
              xs_ds, ilens_ds = xs, ilens
  
          hs, hlens = self.enc(xs_ds, ilens_ds)
          if self.spk_embed_dim is not None:
              spembs = (
                  F.normalize(spembs)
                  .unsqueeze(1)
                  .expand(-1, hs.size(1), -1)
              )
              hs = torch.cat([hs, spembs], dim=-1)
          att_ws = self.dec.calculate_all_attentions(hs, hlens, ys)
      self.train()
  
      return att_ws.cpu().numpy()
  
imports: import logging
  from distutils.util import strtobool
  import numpy
  import torch
  import torch.nn.functional
  from espnet.nets.pytorch_backend.e2e_tts_tacotron2 import Tacotron2Loss
  from espnet.nets.pytorch_backend.e2e_tts_tacotron2 import GuidedAttentionLoss
  from espnet.nets.pytorch_backend.rnn.attentions import AttForward, AttForwardTA, AttLoc
  from espnet.nets.pytorch_backend.tacotron2.cbhg import CBHG, CBHGLoss
  from espnet.nets.pytorch_backend.tacotron2.decoder import Decoder
  from espnet.nets.pytorch_backend.tacotron2.encoder import Encoder
  from espnet.nets.tts_interface import TTSInterface
  from espnet.utils.fill_missing_args import fill_missing_args
label_desc: Use image node_id 5 for calling the Tacotron2 obj's underlying member method code with example usage: obj.calculate_all_attentions(xs, ilens, ys, spembs) and returns: att_ws