code: def plot_attn_matrix(tokens, attn):
      data = [
          dict(type="heatmap", z=attn),
      ]
      layout_ind = copy.deepcopy(layout)
      layout_ind.update(
          {
              "yaxis": dict(
                  tickmode="array",
                  tickvals=list(range(len(tokens))),
                  ticktext=tokens,
              )
          }
      )
      layout_ind.update(
          {
              "xaxis": dict(
                  tickmode="array",
                  tickvals=list(range(len(tokens))),
                  ticktext=tokens,
                  tickangle=45,
              )
          }
      )
      layout_ind.update({"margin": {"t": 20}})
      figure = dict(data=data, layout=layout_ind)
  
      return figure
  
file_path: nlp-architect/solutions/InterpreT/application/plotFunc.py
imports: import base64
  import copy
  from io import BytesIO
  import numpy
  import matplotlib.pyplot
  import plotly.graph_objects
label_desc: Use image node_id 3 for calling a global function with example usage: plot_attn_matrix(tokens, attn) and returns: figure