code: def _prepare_window_args(
      x, low_indices=None, high_indices=None, axis=0
  ):
      """Common argument defaulting logic for windowed statistics."""
      if high_indices is None:
          high_indices = tf.range(ps.shape(x)[axis]) + 1
      else:
          high_indices = tf.convert_to_tensor(high_indices)
      if low_indices is None:
          low_indices = high_indices // 2
      else:
          low_indices = tf.convert_to_tensor(low_indices)
      # Broadcast indices together.
      high_indices = high_indices + tf.zeros_like(low_indices)
      low_indices = low_indices + tf.zeros_like(high_indices)
  
      # TODO(axch): Support batch low and high indices.  That would
      # complicate this shape munging (though tf.gather should work
      # fine).
  
      # We want to place `low_counts` and `high_counts` at the `axis`
      # position, so we reshape them to shape `[1, 1, ..., 1, N, 1, ...,
      # 1]`, where the `N` is at `axis`.  The `counts_shp`, below,
      # is this shape.
      size = ps.size(high_indices)
      counts_shp = ps.one_hot(
          axis, depth=ps.rank(x), on_value=size, off_value=1
      )
  
      low_counts = tf.reshape(
          tf.cast(low_indices, dtype=x.dtype), shape=counts_shp
      )
      high_counts = tf.reshape(
          tf.cast(high_indices, dtype=x.dtype), shape=counts_shp
      )
      return low_indices, high_indices, low_counts, high_counts
  
imports: import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import assert_util
  from tensorflow_probability.python.internal import distribution_util
  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.math.generic import reduce_logmeanexp
label_desc: Use image node_id 10 for calling a global function with example usage: _prepare_window_args(x, low_indices, high_indices, axis) and returns: low_indices,  high_indices,  low_counts,  high_counts