code: def _gen_mask(
      num_blocks,
      n_in,
      n_out,
      mask_type=MASK_EXCLUSIVE,
      dtype=tf.float32,
  ):
      """Generate the mask for building an autoregressive dense layer."""
      # TODO(b/67594795): Better support of dynamic shape.
      mask = np.zeros(
          [n_out, n_in], dtype=dtype_util.as_numpy_dtype(dtype)
      )
      slices = _gen_slices(num_blocks, n_in, n_out, mask_type=mask_type)
      for [row_slice, col_slice] in slices:
          mask[row_slice, col_slice] = 1
      return mask
  
imports: import numpy
  import six
  import tensorflow.compat.v1
  import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import bijector
  from tensorflow_probability.python.bijectors import chain
  from tensorflow_probability.python.bijectors import scale
  from tensorflow_probability.python.bijectors import shift
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import tensorshape_util
  from tensorflow_probability.python.internal import tf_keras
  from tensorflow_probability.python.math.numeric import clip_by_value_preserve_gradient
  from tensorflow.python.util import deprecation
label_desc: Use image node_id 2 for calling a global function with example usage: _gen_mask(num_blocks, n_in, n_out, mask_type, dtype) and returns: mask