code: def test_leading_transpose_with_tf_function_wrapper(
      caplog: LogCaptureFixture,
  ) -> None:
      """Check that no warnings are thrown when compiling `leading_transpose`"""
  
      dims = [1, 2, 3, 4]
      a = tf.zeros(dims)
  
      @tf.function
      def compiled_wrapper() -> tf.Tensor:
          return leading_transpose(a, [..., -1, -2])
  
      compiled_wrapper()
  
      # When Autograph cannot compile a function it sends a WARNING message to the
      # logs.
      log_message_levels = [
          record.levelname for record in caplog.records
      ]
      assert "WARNING" not in log_message_levels
  
file_path: GPflow/tests/gpflow/conditionals/test_util.py
imports: from typing import Optional, Tuple
  import numpy
  import pytest
  import tensorflow
  from _pytest.logging import LogCaptureFixture
  from numpy.testing import assert_allclose, assert_equal
  from gpflow import default_float
  from gpflow.conditionals.util import rollaxis_left, rollaxis_right, sample_mvn
  from gpflow.utilities.ops import leading_transpose
label_desc: Use image node_id 3 for calling a global function with example usage: test_leading_transpose_with_tf_function_wrapper(caplog) and returns: leading_transpose