algorithms/ppo_scm.py
def build_ppo_scm_trainer(scm_config):
    """
    Creates a SCM+MOA+PPO policy class, then creates a trainer with this policy.
    :param scm_config: The configuration dictionary.
    :return: A new SCM+MOA+PPO trainer.
    """
    tf.keras.backend.set_floatx("float32")

    trainer_name = "SCMPPOTrainer"

    scm_ppo_policy = build_tf_policy(
        name="SCMPPOTFPolicy",
        get_default_config=lambda: scm_config,
        loss_fn=loss_with_scm,
        make_model=build_model,
        stats_fn=extra_scm_stats,
        extra_action_fetches_fn=extra_scm_fetches,
        postprocess_fn=postprocess_ppo_scm,
        gradients_fn=clip_gradients,
        before_init=setup_config,
        before_loss_init=setup_ppo_scm_mixins,
        mixins=[LearningRateSchedule, EntropyCoeffSchedule, KLCoeffMixin, ValueNetworkMixin]
        + get_moa_mixins()
        + get_curiosity_mixins(),
    )

    scm_ppo_trainer = build_trainer(
        name=trainer_name,
        default_policy=scm_ppo_policy,
        make_policy_optimizer=choose_policy_optimizer,
        default_config=scm_config,
        validate_config=validate_ppo_scm_config,
        after_optimizer_step=update_kl,
        after_train_result=warn_about_bad_reward_scales,
        mixins=[SCMResetConfigMixin],
    )
    return scm_ppo_trainer

    Creates a SCM+MOA+PPO policy class, then creates a trainer with this policy.
    :param scm_config: The configuration dictionary.
    :return: A new SCM+MOA+PPO trainer.
    
Creates a SCM+MOA+PPO policy class, then creates a trainer with this policy.
Creates a SCM + MOA + PPO policy class then creates a trainer with this policy .
def build_ppo_scm_trainer(scm_config):
    tf.keras.backend.set_floatx("float32")
    trainer_name = "SCMPPOTrainer"
    scm_ppo_policy = build_tf_policy(
        name="SCMPPOTFPolicy",
        get_default_config=lambda: scm_config,
        loss_fn=loss_with_scm,
        make_model=build_model,
        stats_fn=extra_scm_stats,
        extra_action_fetches_fn=extra_scm_fetches,
        postprocess_fn=postprocess_ppo_scm,
        gradients_fn=clip_gradients,
        before_init=setup_config,
        before_loss_init=setup_ppo_scm_mixins,
        mixins=[LearningRateSchedule, EntropyCoeffSchedule, KLCoeffMixin, ValueNetworkMixin]
        + get_moa_mixins()
        + get_curiosity_mixins(),
    )
    scm_ppo_trainer = build_trainer(
        name=trainer_name,
        default_policy=scm_ppo_policy,
        make_policy_optimizer=choose_policy_optimizer,
        default_config=scm_config,
        validate_config=validate_ppo_scm_config,
        after_optimizer_step=update_kl,
        after_train_result=warn_about_bad_reward_scales,
        mixins=[SCMResetConfigMixin],
    )
    return scm_ppo_trainer
def build_ppo_scm_trainer ( scm_config ) : tf . keras . backend . set_floatx ( "float32" ) trainer_name = "SCMPPOTrainer" scm_ppo_policy = build_tf_policy ( name = "SCMPPOTFPolicy" , get_default_config = lambda : scm_config , loss_fn = loss_with_scm , make_model = build_model , stats_fn = extra_scm_stats , extra_action_fetches_fn = extra_scm_fetches , postprocess_fn = postprocess_ppo_scm , gradients_fn = clip_gradients , before_init = setup_config , before_loss_init = setup_ppo_scm_mixins , mixins = [ LearningRateSchedule , EntropyCoeffSchedule , KLCoeffMixin , ValueNetworkMixin ] + get_moa_mixins ( ) + get_curiosity_mixins ( ) , ) scm_ppo_trainer = build_trainer ( name = trainer_name , default_policy = scm_ppo_policy , make_policy_optimizer = choose_policy_optimizer , default_config = scm_config , validate_config = validate_ppo_scm_config , after_optimizer_step = update_kl , after_train_result = warn_about_bad_reward_scales , mixins = [ SCMResetConfigMixin ] , ) return scm_ppo_trainer
Creates a SCM+MOA+PPO policy class, then creates a trainer with this policy.
Creates a SCM + MOA + PPO policy class then creates a trainer with this policy .
"""
    Creates a SCM+MOA+PPO policy class, then creates a trainer with this policy.
    :param scm_config: The configuration dictionary.
    :return: A new SCM+MOA+PPO trainer.
    """
A new SCM+MOA+PPO trainer.
A new SCM + MOA + PPO trainer .
scm_config
The configuration dictionary.
The configuration dictionary .