code: def reshapes_of(draw, shape, max_ndims=4):
      """Strategy for valid reshapes of the given shape, rank at most max_ndims."""
      factors = draw(
          hps.permutations(
              prime_factors(tensorshape_util.num_elements(shape))
          )
      )
      split_points = sorted(
          draw(
              hps.lists(
                  hps.integers(min_value=0, max_value=len(factors)),
                  min_size=0,
                  max_size=max_ndims - 1,
              )
          )
      )
      result = ()
      for start, stop in zip(
          [0] + split_points, split_points + [len(factors)]
      ):
          result += (int(np.prod(factors[start:stop])),)
      return result
  
imports: import collections
  import functools
  import inspect
  from absl import logging
  import hypothesis
  from hypothesis import strategies
  import numpy
  import six
  import tensorflow.compat.v2
  from tensorflow_probability.python import distributions
  from tensorflow_probability.python import util
  from tensorflow_probability.python.bijectors import ascending
  from tensorflow_probability.python.bijectors import hypothesis_testlib
  from tensorflow_probability.python.distributions import distribution
  from tensorflow_probability.python.experimental import distributions
  from tensorflow_probability.python.internal import hypothesis_testlib
  from tensorflow_probability.python.internal import tensorshape_util
label_desc: Use image node_id 16 for calling a global function with example usage: reshapes_of(draw, shape, max_ndims) and returns: result