class_docstr: E2E module for Transducer models.
  
  Args:
      idim: Dimension of inputs.
      odim: Dimension of outputs.
      args: Namespace containing model options.
      ignore_id: Padding symbol ID.
      blank_id: Blank symbol ID.
      training: Whether the model is initialized in training or inference mode.
class_docstr_tok: ["E2E","module","for","Transducer","models",".","Args",":","idim",":","Dimension","of","inputs",".","odim",":","Dimension","of","outputs",".","args",":","Namespace","containing","model","options",".","ignore_id",":","Padding","symbol","ID",".","blank_id",":","Blank","symbol","ID",".","training",":","Whether","the","model","is","initialized","in","training","or","inference","mode","."]
docstr: E2E attention calculation.
  
  Args:
      feats: Feature sequences. (B, F, D_feats)
      feats_len: Feature sequences lengths. (B,)
      labels: Label ID sequences. (B, L)
  
  Returns:
      ret: Attention weights with the following shape,
          1) multi-head case => attention weights. (B, D_att, U, T),
          2) other case => attention weights. (B, U, T)
docstr_tok: ["E2E","attention","calculation",".","Args",":","feats",":","Feature","sequences",".","(","B",",","F",",","D_feats",")","feats_len",":","Feature","sequences","lengths",".","(","B",",",")","labels",":","Label","ID","sequences",".","(","B",",","L",")","Returns",":","ret",":","Attention","weights","with","the","following","shape",",","1",")","multi-head","case","=",">","attention","weights",".","(","B",",","D_att",",","U",",","T",")",",","2",")","other","case","=",">","attention","weights",".","(","B",",","U",",","T",")"]
code: def calculate_all_attentions(
      self,
      feats: torch.Tensor,
      feats_len: torch.Tensor,
      labels: torch.Tensor,
  ) -> numpy.ndarray:
      """E2E attention calculation.
  
      Args:
          feats: Feature sequences. (B, F, D_feats)
          feats_len: Feature sequences lengths. (B,)
          labels: Label ID sequences. (B, L)
  
      Returns:
          ret: Attention weights with the following shape,
              1) multi-head case => attention weights. (B, D_att, U, T),
              2) other case => attention weights. (B, U, T)
  
      """
      self.eval()
  
      if self.etype != "custom" and self.dtype != "custom":
          return []
      else:
          with torch.no_grad():
              self.forward(feats, feats_len, labels)
  
          ret = dict()
          for name, m in self.named_modules():
              if isinstance(m, MultiHeadedAttention) or isinstance(
                  m, RelPositionMultiHeadedAttention
              ):
                  ret[name] = m.attn.cpu().numpy()
  
      self.train()
  
      return ret
  
imports: import logging
  import math
  from argparse import ArgumentParser, Namespace
  from dataclasses import asdict
  from typing import List
  import chainer
  import numpy
  import torch
  from espnet.nets.asr_interface import ASRInterface
  from espnet.nets.beam_search_transducer import BeamSearchTransducer
  from espnet.nets.pytorch_backend.nets_utils import get_subsample, make_non_pad_mask
  from espnet.nets.pytorch_backend.transducer.arguments import add_auxiliary_task_arguments, add_custom_decoder_arguments, add_custom_encoder_arguments, add_custom_training_arguments, add_decoder_general_arguments, add_encoder_general_arguments, add_rnn_decoder_arguments, add_rnn_encoder_arguments, add_transducer_arguments
  from espnet.nets.pytorch_backend.transducer.custom_decoder import CustomDecoder
  from espnet.nets.pytorch_backend.transducer.custom_encoder import CustomEncoder
  from espnet.nets.pytorch_backend.transducer.error_calculator import ErrorCalculator
  from espnet.nets.pytorch_backend.transducer.initializer import initializer
  from espnet.nets.pytorch_backend.transducer.rnn_decoder import RNNDecoder
  from espnet.nets.pytorch_backend.transducer.rnn_encoder import encoder_for
  from espnet.nets.pytorch_backend.transducer.transducer_tasks import TransducerTasks
  from espnet.nets.pytorch_backend.transducer.utils import get_decoder_input, valid_aux_encoder_output_layers
  from espnet.nets.pytorch_backend.transformer.attention import MultiHeadedAttention, RelPositionMultiHeadedAttention
  from espnet.nets.pytorch_backend.transformer.mask import target_mask
  from espnet.nets.pytorch_backend.transformer.plot import PlotAttentionReport
  from espnet.utils.fill_missing_args import fill_missing_args
label_desc: Use image node_id 19 for calling the E2E obj's underlying member method code with example usage: obj.calculate_all_attentions(feats, feats_len, labels) and returns: ret, list