code: def _resample_weights(
      design_matrix,
      target_residuals,
      observation_noise_scale,
      weights_prior_scale,
      seed=None,
  ):
      """Samples regression weights from their conditional posterior.
  
      This assumes a conjugate normal regression model,
  
      ```
      weights ~ Normal(loc=0., covariance_matrix=weights_prior_scale**2 * I)
      target_residuals ~ Normal(loc=matvec(design_matrix, weights),
                                covariance_matrix=observation_noise_scale**2 * I)
      ```
  
      and returns a sample from `p(weights | target_residuals,
        observation_noise_scale, design_matrix)`.
  
      Args:
        design_matrix: Float `Tensor` design matrix of shape `[..., num_timesteps,
          num_features]`.
        target_residuals:  Float `Tensor` of shape `[..., num_observations]`
        observation_noise_scale: Scalar float `Tensor` (with optional batch shape)
          standard deviation of the iid observation noise.
        weights_prior_scale: Instance of `tf.linalg.LinearOperator` of shape
          `[num_features, num_features]` (with optional batch shape), specifying the
          scale of a multivariate Normal prior on regression weights.
        seed: Optional `Python` `int` seed controlling the sampled values.
  
      Returns:
        weights: Float `Tensor` of shape `[..., num_features]`, sampled from
          the conditional posterior `p(weights | target_residuals,
          observation_noise_scale, weights_prior_scale)`.
      """
      (
          weights_mean,
          weights_prec,
      ) = normal_conjugate_posteriors.mvn_conjugate_linear_update(
          linear_transformation=design_matrix,
          observation=target_residuals,
          prior_scale=weights_prior_scale,
          likelihood_scale=tf.linalg.LinearOperatorScaledIdentity(
              num_rows=prefer_static.shape(design_matrix)[-2],
              multiplier=observation_noise_scale,
          ),
      )
      sampled_weights = weights_prec.cholesky().solvevec(
          samplers.normal(
              shape=prefer_static.shape(weights_mean),
              dtype=design_matrix.dtype,
              seed=seed,
          ),
          adjoint=True,
      )
      return weights_mean + sampled_weights
  
imports: import collections
  import itertools
  import numpy
  import six
  import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import identity
  from tensorflow_probability.python.bijectors import invert
  from tensorflow_probability.python.bijectors import square
  from tensorflow_probability.python.distributions import categorical
  from tensorflow_probability.python.distributions import distribution
  from tensorflow_probability.python.distributions import gamma
  from tensorflow_probability.python.distributions import inverse_gamma
  from tensorflow_probability.python.distributions import mixture_same_family
  from tensorflow_probability.python.distributions import mvn_diag
  from tensorflow_probability.python.distributions import mvn_linear_operator
  from tensorflow_probability.python.distributions import normal
  from tensorflow_probability.python.distributions import normal_conjugate_posteriors
  from tensorflow_probability.python.distributions import transformed_distribution
  from tensorflow_probability.python.experimental.distributions import mvn_precision_factor_linop
  from tensorflow_probability.python.experimental.sts_gibbs import dynamic_spike_and_slab
  from tensorflow_probability.python.experimental.sts_gibbs import sample_parameters
  from tensorflow_probability.python.experimental.sts_gibbs import spike_and_slab
  from tensorflow_probability.python.internal import distribution_util
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import reparameterization
  from tensorflow_probability.python.internal import samplers
  from tensorflow_probability.python.sts.components import local_level
  from tensorflow_probability.python.sts.components import local_linear_trend
  from tensorflow_probability.python.sts.components import regression
  from tensorflow_probability.python.sts.components import seasonal
  from tensorflow_probability.python.sts.components import sum
  from tensorflow_probability.python.sts.internal import util
label_desc: Use image node_id 9 for calling a global function with example usage: _resample_weights(design_matrix, target_residuals, observation_noise_scale, weights_prior_scale, seed) and returns: unknown