code: def attention_mask(nd, ns, *, dtype):
      """1's in the lower triangle, counting from the lower right corner.
  
      Same as tf.matrix_band_part(tf.ones([nd, ns]), -1, ns-nd), but doesn't produce garbage on TPUs.
      """
      i = tf.range(nd)[:, None]
      j = tf.range(ns)
      m = i >= j - ns + nd
      return tf.cast(m, dtype)
  
imports: import numpy
  import tensorflow
label_desc: Use image node_id 9 for calling a global function with example usage: attention_mask(nd, ns) and returns: tf