def vae_args_from_config(vae_config):
    """
    Generate a set of VAE args that are read from the VAE-specific part
    of a config (for example see `config.algo.vae` in BCConfig).
    """
    vae_args = dict(
        encoder_layer_dims=vae_config.encoder_layer_dims,
        decoder_layer_dims=vae_config.decoder_layer_dims,
        latent_dim=vae_config.latent_dim,
        decoder_is_conditioned=vae_config.decoder.is_conditioned,
        decoder_reconstruction_sum_across_elements=vae_config.decoder.reconstruction_sum_across_elements,
        latent_clip=vae_config.latent_clip,
        prior_learn=vae_config.prior.learn,
        prior_is_conditioned=vae_config.prior.is_conditioned,
        prior_layer_dims=vae_config.prior_layer_dims,
        prior_use_gmm=vae_config.prior.use_gmm,
        prior_gmm_num_modes=vae_config.prior.gmm_num_modes,
        prior_gmm_learn_weights=vae_config.prior.gmm_learn_weights,
        prior_use_categorical=vae_config.prior.use_categorical,
        prior_categorical_dim=vae_config.prior.categorical_dim,
        prior_categorical_gumbel_softmax_hard=vae_config.prior.categorical_gumbel_softmax_hard,
    )
    return vae_args