code: def test_diags(white: bool) -> None:
      """
      The covariance of q(x) can be Cholesky matrices or diagonal matrices.
      Here we make sure the behaviours overlap.
      """
      # the chols are diagonal matrices, with the same entries as the diag representation.
      chol_from_diag = tf.stack(
          [
              tf.linalg.diag(Datum.sqrt_diag[:, i])
              for i in range(Datum.N)
          ]  # [N, M, M]
      )
      kl_diag = gauss_kl(
          Datum.mu, Datum.sqrt_diag, Datum.K if white else None
      )
      kl_dense = gauss_kl(
          Datum.mu, chol_from_diag, Datum.K if white else None
      )
  
      np.testing.assert_allclose(kl_diag, kl_dense)
  
imports: from unittest.mock import patch
  import numpy
  import pytest
  import tensorflow
  from check_shapes import ShapeChecker, check_shapes
  from numpy.testing import assert_allclose, assert_almost_equal
  import gpflow
  from gpflow import Parameter, default_float, default_jitter
  from gpflow.base import AnyNDArray, TensorType
  from gpflow.inducing_variables import InducingPoints
  from gpflow.kernels import Kernel
  from gpflow.kullback_leiblers import gauss_kl, prior_kl
  from gpflow.utilities.bijectors import triangular
label_desc: Use image node_id 8 for calling a global function with example usage: test_diags(white) without return types