code: def _mat_from_blocks_dense(mb, n_chars_src, n_chars_tgt):
      M = np.zeros((n_chars_src, n_chars_tgt), dtype=_DTYPE)
      for i in range(len(mb)):
          b = mb[i]  # current block
          # Fill in-between this block and last block
          if i > 0:
              lb = mb[i - 1]  # last block
              s0 = lb[0] + lb[2]  # top
              e0 = b[0]  # bottom
              s1 = lb[1] + lb[2]  # left
              e1 = b[1]  # right
              M[s0:e0, s1:e1] = 1
          # Fill matching region on diagonal
          M[b[0] : b[0] + b[2], b[1] : b[1] + b[2]] = 2 * np.identity(
              b[2], dtype=_DTYPE
          )
      return M
  
file_path: jiant/jiant/utils/retokenize.py
imports: from typing import Iterable, Sequence, Tuple, Union
  from Levenshtein.StringMatcher import StringMatcher
  from nltk.tokenize.util import string_span_tokenize
  import numpy
label_desc: Use image node_id 1 for calling a global function with example usage: _mat_from_blocks_dense(mb, n_chars_src, n_chars_tgt) and returns: M