TorchLean API

NN.API.Models.PPO

PPO Actor-Critic Models #

Reusable actor/critic MLP constructors for PPO examples.

These helpers cover the neural-network shape. Environment collection, trust-boundary checks, advantage computation, and optimizer loops stay in the examples/runtime modules.

Configuration for a simple PPO actor/critic pair over vector observations.

  • observationWidth :

    Number of features in each environment observation.

  • hiddenWidth :

    Width of the actor and critic hidden layers.

  • actionCount :

    Number of discrete actions represented by the actor logits.

Instances For

    Validate dimensions used by both PPO networks.

    Instances For

      Validate the actor, including its action-logit width.

      Instances For

        Validate the complete actor-critic configuration.

        Instances For
          @[reducible, inline]
          abbrev TorchLean.nn.models.PPO.Config.inputShape (config : Config) (batchShape : Shape := []) :

          Observation tensor shape with an arbitrary batch shape.

          Instances For
            @[reducible, inline]

            Actor-logit tensor shape with the same batch shape as the observations.

            Instances For
              @[reducible, inline]

              Critic-value tensor shape with the same batch shape as the observations.

              Instances For
                def TorchLean.nn.models.PPO.actor (config : Config) (batchShape : Shape := []) :
                Builder (Sequential (config.inputShape batchShape) (config.actorOutputShape batchShape))

                Actor MLP mapping observations to action logits.

                Instances For
                  def TorchLean.nn.models.PPO.critic (config : Config) (batchShape : Shape := []) :
                  Builder (Sequential (config.inputShape batchShape) (config.criticOutputShape batchShape))

                  Critic MLP mapping observations to a scalar value estimate.

                  Instances For