code: def mtf_range(mesh, dim, dtype, name=None):
    
    dim = convert_to_dimension(dim)
    with tf.variable_scope(name, default_name="range"):
      if dtype == tf.bfloat16:
        # tf.range(dtype=bfloat16) gives the wrong shape.
        # TODO(noam): report the bug.
        tf_range = tf.cast(tf.range(dim.size), tf.bfloat16)
      else:
        tf_range = tf.range(dim.size, dtype=dtype)
      return import_tf_tensor(mesh, tf_range, shape=Shape([dim]))
docs: Create a 1d mesh tensor with a range from [0, dim.size).
  
    Call externally as mtf.range()
  
    Args:
      mesh: a Mesh
      dim: a Dimension
      dtype: a tf.DType
      name: an optional string
  
    Returns:
      a Tensor