code: def mix_latent_gp(
      W: tf.Tensor,
      g_mean: tf.Tensor,
      g_var: tf.Tensor,
      full_cov: bool,
      full_output_cov: bool,
  ) -> MeanAndVariance:
      r"""Takes the mean and variance of an uncorrelated L-dimensional latent GP
      and returns the mean and the variance of the mixed GP, `f = W g`,
      where both f and g are GPs.
  
      :return: f_mean and f_var
      """
      f_mean = tf.tensordot(g_mean, W, [[-1], [-1]])  # [..., N, P]
  
      if full_cov and full_output_cov:  # g_var is [L, ..., N, N]
          # this branch is practically never taken
          g_var = rollaxis_left(g_var, 1)  # [..., N, N, L]
  
          g_var = tf.expand_dims(g_var, axis=-2)  # [..., N, N, 1, L]
          g_var_W = g_var * W  # [..., N, P, L]
          f_var = tf.tensordot(
              g_var_W, W, [[-1], [-1]]
          )  # [..., N, N, P, P]
          f_var = leading_transpose(
              f_var, [..., -4, -2, -3, -1]
          )  # [..., N, P, N, P]
  
      elif full_cov and not full_output_cov:  # g_var is [L, ..., N, N]
          # this branch is practically never taken
          f_var = tf.tensordot(
              g_var, W**2, [[0], [-1]]
          )  # [..., N, N, P]
          f_var = leading_transpose(
              f_var, [..., -1, -3, -2]
          )  # [..., P, N, N]
  
      elif not full_cov and full_output_cov:  # g_var is [..., N, L]
          g_var = tf.expand_dims(g_var, axis=-2)  # [..., N, 1, L]
          g_var_W = g_var * W  # [..., N, P, L]
          f_var = tf.tensordot(
              g_var_W, W, [[-1], [-1]]
          )  # [..., N, P, P]
  
      elif not full_cov and not full_output_cov:  # g_var is [..., N, L]
          W_squared = W**2  # [P, L]
          f_var = tf.tensordot(
              g_var, W_squared, [[-1], [-1]]
          )  # [..., N, P]
  
      return f_mean, f_var
  
file_path: GPflow/gpflow/conditionals/util.py
imports: from typing import Optional, Tuple
  import tensorflow
  from check_shapes import check_shape
  from check_shapes import check_shapes
  from ..base import MeanAndVariance
  from ..config import default_float, default_jitter
  from ..utilities.ops import leading_transpose
label_desc: Use image node_id 10 for calling a global function with example usage: mix_latent_gp(W, g_mean, g_var, full_cov, full_output_cov) and returns: f_mean,  f_var