class_docstr: Sparse GP regression.
  
  The key reference is :cite:t:`titsias2009variational`.
  
  For a use example see :doc:`../../../../notebooks/getting_started/large_data`.
docstr: Compute the mean and variance of the latent function at some new points
  Xnew. For a derivation of the terms in here, see the associated SGPR
  notebook.
docstr_tok: ["Compute","the","mean","and","variance","of","the","latent","function","at","some","new","points","Xnew",".","For","a","derivation","of","the","terms","in","here",",","see","the","associated","SGPR","notebook","."]
code: def predict_f(
      self,
      Xnew: InputData,
      full_cov: bool = False,
      full_output_cov: bool = False,
  ) -> MeanAndVariance:
      """
      Compute the mean and variance of the latent function at some new points
      Xnew. For a derivation of the terms in here, see the associated SGPR
      notebook.
      """
      # could copy into posterior into a fused version
  
      assert_params_false(
          self.predict_f, full_output_cov=full_output_cov
      )
  
      X_data, Y_data = self.data
      num_inducing = self.inducing_variable.num_inducing
      err = Y_data - self.mean_function(X_data)
      kuf = Kuf(self.inducing_variable, self.kernel, X_data)
      kuu = Kuu(
          self.inducing_variable, self.kernel, jitter=default_jitter()
      )
      Kus = Kuf(self.inducing_variable, self.kernel, Xnew)
  
      sigma_sq = tf.squeeze(
          self.likelihood.variance_at(X_data), axis=-1
      )
      sigma = tf.sqrt(sigma_sq)
  
      L = tf.linalg.cholesky(kuu)  # cache alpha, qinv
      A = tf.linalg.triangular_solve(L, kuf / sigma, lower=True)
      B = tf.linalg.matmul(A, A, transpose_b=True) + tf.eye(
          num_inducing, dtype=default_float()
      )  # cache qinv
      LB = tf.linalg.cholesky(B)  # cache alpha
      Aerr = tf.linalg.matmul(A, err / sigma[..., None])
      c = tf.linalg.triangular_solve(LB, Aerr, lower=True)
      tmp1 = tf.linalg.triangular_solve(L, Kus, lower=True)
      tmp2 = tf.linalg.triangular_solve(LB, tmp1, lower=True)
      mean = tf.linalg.matmul(tmp2, c, transpose_a=True)
      if full_cov:
          var = (
              self.kernel(Xnew)
              + tf.linalg.matmul(tmp2, tmp2, transpose_a=True)
              - tf.linalg.matmul(tmp1, tmp1, transpose_a=True)
          )
          var = tf.tile(
              var[None, ...], [self.num_latent_gps, 1, 1]
          )  # [P, N, N]
      else:
          var = (
              self.kernel(Xnew, full_cov=False)
              + tf.reduce_sum(tf.square(tmp2), 0)
              - tf.reduce_sum(tf.square(tmp1), 0)
          )
          var = tf.tile(var[:, None], [1, self.num_latent_gps])
  
      return mean + self.mean_function(Xnew), var
  
imports: from typing import NamedTuple, Optional, Tuple
  import numpy
  import tensorflow
  from check_shapes import check_shapes, inherit_check_shapes
  from ..None import posteriors
  from ..base import InputData, MeanAndVariance, RegressionData, TensorData
  from ..config import default_float, default_jitter
  from ..covariances.dispatch import Kuf, Kuu
  from ..inducing_variables import InducingPoints
  from ..kernels import Kernel
  from ..likelihoods import Gaussian
  from ..mean_functions import MeanFunction
  from ..utilities import add_noise_cov, assert_params_false, to_default_float
  from .model import GPModel
  from .training_mixins import InternalDataTrainingLossMixin
  from .util import InducingPointsLike, data_input_to_tensor, inducingpoint_wrapper
label_desc: Use image node_id 6 for calling the SGPR_deprecated obj's underlying member method code with example usage: obj.predict_f(Xnew, full_cov, full_output_cov) and returns: unknown,  var