code: def assert_gpr_vs_vgp(
      m1: BayesianModel,
      m2: BayesianModel,
      gamma: float = 1.0,
      maxiter: int = 1,
      xi_transform: Optional[
          gpflow.optimizers.natgrad.XiTransform
      ] = None,
  ) -> None:
      assert maxiter >= 1
  
      m1_ll_before = m1.training_loss()
      m2_ll_before = m2.training_loss()
  
      assert_different(m2_ll_before, m1_ll_before)
  
      params: Tuple[Any, ...] = (m2.q_mu, m2.q_sqrt)
      if xi_transform is not None:
          params += (xi_transform,)
  
      opt = NaturalGradient(gamma)
  
      @tf.function
      def minimize_step() -> None:
          opt.minimize(m2.training_loss, var_list=[params])  # type: ignore[list-item]
  
      for _ in range(maxiter):
          minimize_step()
  
      m1_ll_after = m1.training_loss()
      m2_ll_after = m2.training_loss()
  
      np.testing.assert_allclose(m1_ll_after, m2_ll_after, atol=1e-4)
  
imports: from typing import Any, Optional, Tuple
  import numpy
  import pytest
  import tensorflow
  from check_shapes import check_shapes
  import gpflow
  from gpflow import set_trainable
  from gpflow.config import default_float
  from gpflow.kernels import Kernel, SquaredExponential
  from gpflow.likelihoods import Gaussian, Likelihood
  from gpflow.models import GPR, SGPR, SVGP, VGP, BayesianModel
  from gpflow.optimizers import NaturalGradient
label_desc: Use image node_id 8 for calling a global function with example usage: assert_gpr_vs_vgp(m1, m2, gamma, maxiter, xi_transform) without return types