code: def _block_add(*ms):
      """Adds block matrices represented as nested lists."""
      # Calls itself recursively to add blocks, until reaches the level of
      # tf.Tensors.
      if len(ms) == 1:
          return ms[0]
      if isinstance(ms[0], tf.Tensor):
          assert all(isinstance(m, tf.Tensor) for m in ms[1:])
          return tf.math.add_n(ms)
      assert all(_is_nested_list(m) for m in ms)
      for i in range(1, len(ms)):
          tf.nest.assert_same_structure(ms[0], ms[i])
  
      i_max = len(ms[0])
      j_max = 0 if i_max == 0 else len(ms[0][0])
      return [
          [
              _block_add(*[ms[k][i][j] for k in range(len(ms))])
              for j in range(j_max)
          ]
          for i in range(i_max)
      ]
  
file_path: tf-quant-finance/tf_quant_finance/math/custom_loops.py
imports: import tensorflow.compat.v2
  from tf_quant_finance import utils
label_desc: Use image node_id 8 for calling a global function with example usage: _block_add() and returns: unknown, ms, tf