code: def independent_interdomain_conditional(
      Kmn: tf.Tensor,
      Kmm: tf.Tensor,
      Knn: tf.Tensor,
      f: tf.Tensor,
      *,
      full_cov: bool = False,
      full_output_cov: bool = False,
      q_sqrt: Optional[tf.Tensor] = None,
      white: bool = False,
  ) -> MeanAndVariance:
      """
      The inducing outputs live in the g-space (R^L).
  
      Interdomain conditional calculation.
  
      :param full_cov: calculate covariance between inputs
      :param full_output_cov: calculate covariance between outputs
      :param white: use whitened representation
      :return: mean, variance
      """
      M, L, N, P = tf.unstack(
          tf.shape(Kmn), num=Kmn.shape.ndims, axis=0
      )
  
      Lm = tf.linalg.cholesky(Kmm)  # [L, M, M]
  
      # Compute the projection matrix A
      Kmn = tf.reshape(tf.transpose(Kmn, (1, 0, 2, 3)), (L, M, N * P))
      A = tf.linalg.triangular_solve(
          Lm, Kmn, lower=True
      )  # [L, M, M] \ [L, M, N*P] -> [L, M, N*P]
      Ar = tf.reshape(A, (L, M, N, P))
  
      # compute the covariance due to the conditioning
      if full_cov and full_output_cov:
          fvar = Knn - tf.tensordot(
              Ar, Ar, [[0, 1], [0, 1]]
          )  # [N, P, N, P]
      elif full_cov and not full_output_cov:
          At = tf.reshape(tf.transpose(Ar), (P, N, M * L))  # [P, N, L]
          fvar = Knn - tf.linalg.matmul(
              At, At, transpose_b=True
          )  # [P, N, N]
      elif not full_cov and full_output_cov:
          At = tf.reshape(
              tf.transpose(Ar, [2, 3, 1, 0]), (N, P, M * L)
          )  # [N, P, L]
          fvar = Knn - tf.linalg.matmul(
              At, At, transpose_b=True
          )  # [N, P, P]
      elif not full_cov and not full_output_cov:
          fvar = Knn - tf.reshape(
              tf.reduce_sum(tf.square(A), [0, 1]), (N, P)
          )  # Knn: [N, P]
  
      # another backsubstitution in the unwhitened case
      if not white:
          A = tf.linalg.triangular_solve(
              Lm, A, adjoint=True
          )  # [L, M, M] \ [L, M, N*P]  ->  [L, M, N*P]
          Ar = tf.reshape(A, (L, M, N, P))
  
      fmean = tf.tensordot(Ar, f, [[1, 0], [0, 1]])  # [N, P]
  
      if q_sqrt is not None:
          if q_sqrt.shape.ndims == 3:
              Lf = tf.linalg.band_part(q_sqrt, -1, 0)  # [L, M, M]
              LTA = tf.linalg.matmul(
                  Lf, A, transpose_a=True
              )  # [L, M, M]  *  [L, M, P]  ->  [L, M, P]
          else:  # q_sqrt [M, L]
              LTA = A * tf.transpose(q_sqrt)[..., None]  # [L, M, P]
  
          if full_cov and full_output_cov:
              LTAr = tf.reshape(LTA, (L * M, N * P))
              fvar = fvar + tf.reshape(
                  tf.linalg.matmul(LTAr, LTAr, transpose_a=True),
                  (N, P, N, P),
              )
          elif full_cov and not full_output_cov:
              LTAr = tf.transpose(
                  tf.reshape(LTA, (L * M, N, P)), [2, 0, 1]
              )  # [P, M, N]
              fvar = fvar + tf.linalg.matmul(
                  LTAr, LTAr, transpose_a=True
              )  # [P, N, N]
          elif not full_cov and full_output_cov:
              LTAr = tf.transpose(
                  tf.reshape(LTA, (L * M, N, P)), [1, 0, 2]
              )  # [N, M, P]
              fvar = fvar + tf.linalg.matmul(
                  LTAr, LTAr, transpose_a=True
              )  # [N, P, P]
          elif not full_cov and not full_output_cov:
              fvar = fvar + tf.reshape(
                  tf.reduce_sum(tf.square(LTA), (0, 1)), (N, P)
              )
  
      return fmean, fvar
  
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 5 for calling a global function with example usage: independent_interdomain_conditional(Kmn, Kmm, Knn, f) and returns: fmean,  fvar