code: def _assert_same_shape(
      x, y, message="Shapes do not match.", validate_args=False
  ):
      """Asserts (statically if possible) that two Tensor have the same shape."""
      if not tensorshape_util.is_compatible_with(x.shape, y.shape):
          raise ValueError(
              message
              + " Saw shapes: {} vs {}.".format(x.shape, y.shape)
          )
  
      assertions = []
      if validate_args and not (
          tensorshape_util.is_fully_defined(x.shape)
          and tensorshape_util.is_fully_defined(y.shape)
      ):
          assertions.append(
              assert_util.assert_equal(
                  tf.shape(x), tf.shape(y), message=message
              )
          )
      return assertions
  
imports: import functools
  import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import bijector
  from tensorflow_probability.python.distributions import distribution
  from tensorflow_probability.python.distributions import log_prob_ratio
  from tensorflow_probability.python.internal import assert_util
  from tensorflow_probability.python.internal import distribution_util
  from tensorflow_probability.python.internal import parameter_properties
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import samplers
  from tensorflow_probability.python.internal import tensor_util
  from tensorflow_probability.python.internal import tensorshape_util
  from tensorflow_probability.python.math import generic
label_desc: Use image node_id 2 for calling a global function with example usage: _assert_same_shape(x, y, message, validate_args) and returns: assertions