code: def test_monte_carlo_2_din(white: bool, mean: Optional[str]) -> None:
      kernel = gpflow.kernels.SquaredExponential(variance=rng.rand())
      mean_function = mean_function_factory(
          mean, DataMC2.D_in, DataMC2.D_out
      )
      model = MomentMatchingSVGP(
          kernel,
          gpflow.likelihoods.Gaussian(),
          num_latent_gps=DataMC2.D_out,
          mean_function=mean_function,
          inducing_variable=DataMC2.X.copy(),
          whiten=white,
      )
      model.full_output_cov = True
  
      training_loop(
          model.training_loss_closure(DataMC2.data),
          optimizer=tf.optimizers.Adam(),
          var_list=model.trainable_variables,
          maxiter=100,
          compile=True,
      )
  
      mean1, var1 = model.uncertain_predict_f_moment_matching(
          *map(
              tf.convert_to_tensor,
              [DataMC2.Xnew_mu, DataMC2.Xnew_covar],
          )
      )
  
      for n in range(DataMC2.N_new):
          mean2, var2 = model.uncertain_predict_f_monte_carlo(
              DataMC2.Xnew_mu[n, ...], DataMC2.L[n, ...]
          )
          assert_allclose(mean1[n, ...], mean2, atol=1e-2)
          assert_allclose(var1[n, ...], var2, atol=1e-2)
  
imports: from typing import Collection, Optional
  import numpy
  import pytest
  import tensorflow
  from check_shapes import ShapeChecker, check_shapes
  from numpy.testing import assert_allclose
  import gpflow
  from gpflow.base import AnyNDArray, MeanAndVariance
  from gpflow.conditionals import conditional, uncertain_conditional
  from gpflow.config import default_float
  from gpflow.mean_functions import Constant, Linear, MeanFunction, Zero
  from gpflow.quadrature import mvnquad
  from gpflow.utilities import training_loop
label_desc: Use image node_id 6 for calling a global function with example usage: test_monte_carlo_2_din(white, mean) without return types