训练代理可以返回允许您访问模型的策略:
agent = ppo.PPOTrainer(config, env=select_env)
policy = agent.get_policy()
policy.model.base_model.summary() # Prints the model summary
样本输出:
Layer (type) Output Shape Param # Connected to
==================================================================================================
observations (InputLayer) [(None, 7)] 0 []
fc_1 (Dense) (None, 256) 2048 ['observations[0][0]']
fc_value_1 (Dense) (None, 256) 2048 ['observations[0][0]']
fc_2 (Dense) (None, 256) 65792 ['fc_1[0][0]']
fc_value_2 (Dense) (None, 256) 65792 ['fc_value_1[0][0]']
fc_out (Dense) (None, 5) 1285 ['fc_2[0][0]']
value_out (Dense) (None, 1) 257 ['fc_value_2[0][0]']
==================================================================================================
Total params: 137,222
Trainable params: 137,222
Non-trainable params: 0