class_docstr: Plot attention reporter.
  
  Args:
      att_vis_fn (espnet.nets.*_backend.e2e_asr.calculate_all_attentions):
          Function of attention visualization.
      data (list[tuple(str, dict[str, dict[str, Any]])]): List json utt key items.
      outdir (str): Directory to save figures.
      converter (espnet.asr.*_backend.asr.CustomConverter):
          CustomConverter object. Function to convert data.
      device (torch.device): The destination device to send tensor.
      reverse (bool): If True, input and output length are reversed.
class_docstr_tok: ["Plot","attention","reporter",".","Args",":","att_vis_fn","(","espnet.nets",".","*","_backend.e2e_asr.calculate_all_attentions",")",":","Function","of","attention","visualization",".","data","(","list","[","tuple","(","str",",","dict","[","str",",","dict","[","str",",","Any","]","]",")","]",")",":","List","json","utt","key","items",".","outdir","(","str",")",":","Directory","to","save","figures",".","converter","(","espnet.asr",".","*","_backend.asr.CustomConverter",")",":","CustomConverter","object",".","Function","to","convert","data",".","device","(","torch.device",")",":","The","destination","device","to","send","tensor",".","reverse","(","bool",")",":","If","True",",","input","and","output","length","are","reversed","."]
docstr: Transform attention weight in regard to self.reverse.
docstr_tok: ["Transform","attention","weight","in","regard","to","self.reverse","."]
code: def get_attention_weight(self, idx, att_w, spkr_idx):
      """Transform attention weight in regard to self.reverse."""
      if self.reverse:
          dec_len = int(self.data[idx][1]["input"][0]["shape"][0])
          enc_len = int(
              self.data[idx][1]["output"][spkr_idx]["shape"][0]
          )
      else:
          dec_len = int(
              self.data[idx][1]["output"][spkr_idx]["shape"][0]
          )
          enc_len = int(self.data[idx][1]["input"][0]["shape"][0])
      if len(att_w.shape) == 3:
          att_w = att_w[:, :dec_len, :enc_len]
      else:
          att_w = att_w[:dec_len, :enc_len]
      return att_w
  
file_path: espnet/espnet/asr/asr_mix_utils.py
imports: import copy
  import logging
  import os
  from chainer.training import extension
  from espnet.asr.asr_utils import parse_hypothesis
label_desc: Use image node_id 5 for calling the PlotAttentionReport obj's underlying member method code with example usage: obj.get_attention_weight(idx, att_w, spkr_idx) and returns: att_w