code: def _resample_seasonal_scales(
      seasonal_components,
      seasonal_latents,
      seasonal_seed,
  ):
      """Samples the scales of the seasonal components given their latents.
  
      Args:
        seasonal_components: A non-empty list of seasonal components.
        seasonal_latents: A tensor of shape [batch shape, timeseries length, latents
          across all seasonal components].
        seasonal_seed: The per-seasonal component list of seeds.
  
      Returns:
        A tensor of seasonal scale samples, of shape [batch shape,
        number of seasonal components].
      """
      seasonal_seeds = samplers.split_seed(
          seasonal_seed,
          n=len(seasonal_components),
          salt="sample_seasonal_scales",
      )
      seasonal_drift_scales_list = []
      # Seasonal latents are in sequence, thus track the index.
      next_latent_index = 0
      for seasonal_component, seasonal_seed in itertools.zip_longest(
          seasonal_components, seasonal_seeds
      ):
          # Select the latents for this seasonal component.
          num_component_latents = seasonal_component.latent_size
          seasonal_component_latents = seasonal_latents[
              ...,
              next_latent_index : next_latent_index
              + num_component_latents,
          ]
          next_latent_index += num_component_latents
          seasonal_drift_scales_list.append(
              seasonal_component.experimental_resample_drift_scale(
                  latents=seasonal_component_latents,
                  seed=seasonal_seed,
              )
          )
      number_of_latents = seasonal_latents.shape[-1]
      if next_latent_index != number_of_latents:
          raise TypeError(
              f"Some seasonal latent values were not used. {next_latent_index} were "
              "used, but there were {number_of_latents} latents. Are you using "
              "unsupported structual components?"
          )
  
      return tf.stack(
          seasonal_drift_scales_list,
          # Seasonal component is the last dimension.
          axis=-1,
      )
  
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 13 for calling a global function with example usage: _resample_seasonal_scales(seasonal_components, seasonal_latents, seasonal_seed) and returns: tf