code: def semilocal_linear_trend_transition_noise(
      level_scale, slope_mean, slope_scale, autoregressive_coef
  ):
      """Build the transition noise model for a semi-local linear trend model."""
  
      # At each timestep, the stochasticity of `level` and `slope` are given
      # by `level_scale` and `slope_scale` respectively.
      broadcast_batch_shape = dist_util.get_broadcast_shape(
          level_scale, slope_mean, slope_scale, autoregressive_coef
      )
      broadcast_ones = tf.ones(
          broadcast_batch_shape, dtype=level_scale.dtype
      )
      scale_diag = tf.stack(
          [level_scale * broadcast_ones, slope_scale * broadcast_ones],
          axis=-1,
      )
  
      # We additionally fold in a bias term implementing the nonzero `slope_mean`.
      # The overall `slope` update is (from `SemiLocalLinearTrend` docstring)
      #   slope[t] = (slope_mean +
      #               autoregressive_coef * (slope[t-1] - slope_mean) +
      #               Normal(0., slope_scale))
      # which we rewrite as
      #   slope[t] = (
      #    autoregressive_coef * slope[t-1] +                  # linear transition
      #    Normal(loc=slope_mean - autoregressive_coef * slope_mean,  # noise bias
      #           scale=slope_scale))                                 # noise scale
      bias = tf.stack(
          [
              tf.zeros_like(broadcast_ones),
              slope_mean * (1 - autoregressive_coef) * broadcast_ones,
          ],
          axis=-1,
      )
      return mvn_diag.MultivariateNormalDiag(
          loc=bias, scale_diag=scale_diag
      )
  
imports: import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import chain
  from tensorflow_probability.python.bijectors import identity
  from tensorflow_probability.python.bijectors import scale
  from tensorflow_probability.python.bijectors import sigmoid
  from tensorflow_probability.python.bijectors import softplus
  from tensorflow_probability.python.bijectors import tanh
  from tensorflow_probability.python.distributions import linear_gaussian_ssm
  from tensorflow_probability.python.distributions import lognormal
  from tensorflow_probability.python.distributions import mvn_diag
  from tensorflow_probability.python.distributions import normal
  from tensorflow_probability.python.internal import distribution_util
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.sts.internal import util
  from tensorflow_probability.python.sts.structural_time_series import Parameter
  from tensorflow_probability.python.sts.structural_time_series import StructuralTimeSeries
label_desc: Use image node_id 2 for calling a global function with example usage: semilocal_linear_trend_transition_noise(level_scale, slope_mean, slope_scale, autoregressive_coef) and returns: mvn_diag