code: def _create_degrees(
      input_size,
      hidden_units=None,
      input_order="left-to-right",
      hidden_degrees="equal",
      seed=None,
  ):
      """Returns a list of degree vectors, one for each input and hidden layer.
  
      A unit with degree d can only receive input from units with degree < d. Output
      units always have the same degree as their associated input unit.
  
      Args:
        input_size: Number of inputs.
        hidden_units: list with the number of hidden units per layer. It does not
          include the output layer. Each hidden unit size must be at least the size
          of length (otherwise autoregressivity is not possible).
        input_order: Order of degrees to the input units: 'random', 'left-to-right',
          'right-to-left', or an array of an explicit order. For example,
          'left-to-right' builds an autoregressive model
          p(x) = p(x1) p(x2 | x1) ... p(xD | x<D).
        hidden_degrees: Method for assigning degrees to the hidden units:
          'equal', 'random'.  If 'equal', hidden units in each layer are allocated
          equally (up to a remainder term) to each degree.  Default: 'equal'.
        seed: If not `None`, use as a seed for the 'random' hidden_degrees.
  
      Raises:
        ValueError: invalid input order.
        ValueError: invalid hidden degrees.
      """
      input_order = _create_input_order(input_size, input_order)
      degrees = [input_order]
  
      if hidden_units is None:
          hidden_units = []
  
      for units in hidden_units:
          if isinstance(hidden_degrees, six.string_types):
              if hidden_degrees == "random":
                  if seed is None:
                      rng = np.random
                  else:
                      rng = np.random.RandomState(seed)
                  # samples from: [low, high)
                  degrees.append(
                      rng.randint(
                          low=min(np.min(degrees[-1]), input_size - 1),
                          high=input_size,
                          size=units,
                      )
                  )
              elif hidden_degrees == "equal":
                  min_degree = min(np.min(degrees[-1]), input_size - 1)
                  degrees.append(
                      np.maximum(
                          min_degree,
                          # Evenly divide the range `[1, input_size - 1]` in to `units + 1`
                          # segments, and pick the boundaries between the segments as degrees.
                          np.ceil(
                              np.arange(1, units + 1)
                              * (input_size - 1)
                              / float(units + 1)
                          ).astype(np.int32),
                      )
                  )
          else:
              raise ValueError(
                  'Invalid hidden order: "{}".'.format(hidden_degrees)
              )
  
      return degrees
  
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 8 for calling a global function with example usage: _create_degrees(input_size, hidden_units, input_order, hidden_degrees, seed) and returns: degrees