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: Add image files of attention matrix to tensorboard.
docstr_tok: ["Add","image","files","of","attention","matrix","to","tensorboard","."]
code: def log_attentions(self, logger, step):
      """Add image files of attention matrix to tensorboard."""
      att_ws_sd = self.get_attention_weights()
      for ns, att_ws in enumerate(att_ws_sd):
          for idx, att_w in enumerate(att_ws):
              att_w = self.get_attention_weight(idx, att_w, ns)
              plot = self.draw_attention_plot(att_w)
              logger.add_figure(
                  "%s" % (self.data[idx][0]), plot.gcf(), step
              )
              plot.clf()
  
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 3 for calling the PlotAttentionReport obj's underlying member method code with example usage: obj.log_attentions(logger, step) without return types