code: def shapes(
      draw, min_ndims=0, max_ndims=3, min_lastdimsize=1, max_side=None
  ):
      """Strategy for drawing TensorShapes with some control over rank/dim sizes.
  
      Args:
        draw: Hypothesis strategy sampler supplied by `@hps.composite`.
        min_ndims: Python `int` giving the minimum rank.
        max_ndims: Python `int` giving the maximum rank.
        min_lastdimsize: Python `int`.  The trailing dimension will always be at
          least this large.  Ignored if the rank turns out to be 0.
        max_side: Python `int` giving the maximum size of each dimension
  
      Returns:
        shapes: A strategy for drawing fully-specified TensorShapes obeying
          these constraints.
      """
      rank = draw(
          hps.integers(min_value=min_ndims, max_value=max_ndims)
      )
      shape = tf.TensorShape(None).with_rank(rank)
      if rank > 0:
  
          def resize_lastdim(x):
              return x[:-1] + (max(x[-1], min_lastdimsize),)
  
          if max_side is None:
              # Apparently we can't pass an explicit None to the Hypothesis strategy?
              shps = hpnp.array_shapes(min_dims=rank, max_dims=rank)
          else:
              shps = hpnp.array_shapes(
                  min_dims=rank, max_dims=rank, max_side=max_side
              )
          shape = draw(shps.map(resize_lastdim).map(tf.TensorShape))
      return shape
  
imports: import contextlib
  import os
  import re
  import traceback
  import unittest
  import hypothesis
  from hypothesis.extra import numpy
  import hypothesis.strategies
  import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import tensorshape_util
  from tensorflow_probability.python.util.deferred_tensor import DeferredTensor
label_desc: Use image node_id 20 for calling a global function with example usage: shapes(draw, min_ndims, max_ndims, min_lastdimsize, max_side) and returns: shape, unknown