code: def assert_compatible_matrix_dimensions(operator, x):
      """Assert that an argument to solve/matmul has proper domain dimension.
  
      If `tensor_shape.TensorShape(operator.shape)[-2:] = [M, N]`, and `tensor_shape.TensorShape(x.shape)[-2:] = [Q, R]`, then
      `operator.matmul(x)` is defined only if `N = Q`.  This `Op` returns an
      `Assert` that "fires" if this is not the case.  Static checks are already
      done by the base class `LinearOperator`.
  
      Args:
        operator:  `LinearOperator`.
        x:  `Tensor`.
  
      Returns:
        `Assert` `Op`.
      """
      # Static checks are done in the base class.  Only tensor asserts here.
      assert_same_dd = check_ops.assert_equal(
          prefer_static.shape(x)[-2],
          operator.domain_dimension_tensor(),
          # This error message made to look similar to error raised by static check
          # in the base class.
          message=(
              "Dimensions are not compatible.  "
              "shape[-2] of argument to be the same as this operator"
          ),
      )
  
      return assert_same_dd
  
imports: import numpy
  from tensorflow_probability.python.internal.backend.numpy import dtype
  from tensorflow_probability.python.internal.backend.numpy import ops
  from tensorflow_probability.python.internal.backend.numpy import ops
  from tensorflow_probability.python.internal.backend.numpy import numpy_array
  from tensorflow_probability.python.internal.backend.numpy import debugging
  from tensorflow_probability.python.internal.backend.numpy import control_flow
  from tensorflow_probability.python.internal.backend.numpy import linalg_impl
  from tensorflow_probability.python.internal.backend.numpy import numpy_math
  from tensorflow_probability.python.internal.backend.numpy import ops
  from tensorflow_probability.python.internal.backend.numpy import nest
  import numpy
  from tensorflow_probability.python.internal.backend.numpy import linalg_impl
  from tensorflow_probability.python.internal.backend.numpy import ops
  from tensorflow_probability.python.internal.backend.numpy.gen import tensor_shape
  from tensorflow_probability.python.internal.backend.numpy import private
label_desc: Use image node_id 9 for calling a global function with example usage: assert_compatible_matrix_dimensions(operator, x) and returns: assert_same_dd