code: def stochastic_volatility_prior_fn(num_timesteps, use_markov_chain):
      """Generative process for the stochastic volatility model."""
      persistence_of_volatility = yield Root(
          tfd.TransformedDistribution(
              tfd.Beta(concentration1=20.0, concentration0=1.5),
              tfb.Shift(-1.0)(tfb.Scale(2.0)),
              name="persistence_of_volatility",
          )
      )
      mean_log_volatility = yield Root(
          tfd.Cauchy(loc=0.0, scale=5.0, name="mean_log_volatility")
      )
      white_noise_shock_scale = yield Root(
          tfd.HalfCauchy(
              loc=0.0, scale=2.0, name="white_noise_shock_scale"
          )
      )
  
      if use_markov_chain:
          yield autoregressive_series_markov_chain(
              num_timesteps=num_timesteps,
              mean=mean_log_volatility,
              noise_scale=white_noise_shock_scale,
              persistence=persistence_of_volatility,
              name="log_volatility",
          )
      else:
          yield tfd.JointDistributionCoroutine(
              functools.partial(
                  autoregressive_series_fn,
                  num_timesteps=num_timesteps,
                  mean=mean_log_volatility,
                  noise_scale=white_noise_shock_scale,
                  persistence=persistence_of_volatility,
              ),
              name="log_volatility",
          )
  
imports: import collections
  import functools
  import tensorflow.compat.v2
  import tensorflow_probability
  from tensorflow_probability.python.internal import prefer_static
  from inference_gym.internal import data
  from inference_gym.targets import bayesian_model
  from inference_gym.targets import model
  from inference_gym.targets.ground_truth import stochastic_volatility_sp500
  from inference_gym.targets.ground_truth import stochastic_volatility_sp500_small
label_desc: Use image node_id 3 for calling a global function with example usage: stochastic_volatility_prior_fn(num_timesteps, use_markov_chain) without return types