code: def update_vgp_data(
      vgp: VGP_deprecated, new_data: RegressionData
  ) -> None:
      """
      Set the data on the given VGP model, and update its variational parameters.
  
      As opposed to many of the other models the VGP has internal parameters whose shape depends on
      the shape of the data. This functions updates the internal data of the given vgp, and updates
      the variational parameters to fit.
  
      This function requires that the input `vgp` were create with :class:`tf.Variable`s for
      `data`.
      """
      old_X_data, old_Y_data = vgp.data
      assert is_variable(old_X_data) and is_variable(
          old_Y_data
      ), "update_vgp_data requires the model to have been created with variable data."
  
      new_X_data, new_Y_data = new_data
      new_num_data = tf.shape(new_X_data)[0]
      f_mu, f_cov = vgp.predict_f(
          new_X_data, full_cov=True
      )  # [N, L], [L, N, N]
  
      # This model is hard-coded to use the whitened representation, i.e.  q_mu and q_sqrt
      # parametrize q(v), and u = f(X) = L v, where L = cholesky(K(X, X)) Hence we need to
      # back-transform from f_mu and f_cov to obtain the updated new_q_mu and new_q_sqrt:
      Knn = vgp.kernel(new_X_data, full_cov=True)  # [N, N]
      jitter_mat = default_jitter() * tf.eye(
          new_num_data, dtype=Knn.dtype
      )
      Lnn = tf.linalg.cholesky(Knn + jitter_mat)  # [N, N]
      new_q_mu = tf.linalg.triangular_solve(Lnn, f_mu)  # [N, L]
      tmp = tf.linalg.triangular_solve(
          Lnn[None], f_cov
      )  # [L, N, N], L⁻¹ f_cov
      S_v = tf.linalg.triangular_solve(
          Lnn[None], tf.linalg.matrix_transpose(tmp)
      )  # [L, N, N]
      new_q_sqrt = tf.linalg.cholesky(S_v + jitter_mat)  # [L, N, N]
  
      old_X_data.assign(new_X_data)
      old_Y_data.assign(new_Y_data)
      vgp.num_data.assign(new_num_data)
      vgp.q_mu.assign(new_q_mu)
      vgp.q_sqrt.assign(new_q_sqrt)
  
imports: from typing import Optional
  import numpy
  import tensorflow
  from check_shapes import check_shapes, inherit_check_shapes
  import gpflow
  from ..None import posteriors
  from ..base import InputData, MeanAndVariance, Parameter, RegressionData
  from ..conditionals import conditional
  from ..config import default_float, default_jitter
  from ..kernels import Kernel
  from ..kullback_leiblers import gauss_kl
  from ..likelihoods import Likelihood
  from ..mean_functions import MeanFunction
  from ..utilities import assert_params_false, is_variable, triangular, triangular_size
  from .model import GPModel
  from .training_mixins import InternalDataTrainingLossMixin
  from .util import data_input_to_tensor
label_desc: Use image node_id 1 for calling a global function with example usage: update_vgp_data(vgp, new_data) without return types