code: def test_dynamic_shape_has_static_info_in_graph(
      self, x_shape, num_dims
  ):
      y_shape = (np.prod(x_shape[:num_dims]),) + x_shape[num_dims:]
  
      @tf.function
      def merge(x, num_dims):
          y = batch_apply.merge_leading_dims(x, num_dims)
          self.assertIsNotNone(y.shape.dims)
          y.shape.assert_is_compatible_with(y_shape)
          # Make sure we have static shape info except for the trailing None.
          self.assertNotIn(None, y.shape[:-1])
          self.assertIsNone(y.shape[-1])
          return y
  
      # Fill `None` in the last dimension (which won't be merged).
      x = tf.TensorSpec(x_shape[:-1] + (None,))
      cf = merge.get_concrete_function(x, num_dims)
      y_shape_dynamic = cf.output_shapes
      y_shape_dynamic.assert_is_compatible_with(y_shape)
  
imports: from absl.testing import parameterized
  import numpy
  from sonnet.src import base
  from sonnet.src import batch_apply
  from sonnet.src import test_utils
  import tensorflow
label_desc: Use image node_id 4 for calling the MergeLeadingDimsTest obj's underlying member method code with example usage: obj.test_dynamic_shape_has_static_info_in_graph(x_shape, num_dims) and returns: y