Skip to main content

Module mlp

Module mlp 

Source
Expand description

MLP actor-critic policy used by the CartPole / Pong / SimpleBandit PPO trainers. Burn-backend MLP actor-critic policy.

Implements a 2/3-layer MLP actor-critic architecture with orthogonal initialization (PPO recipe — gain sqrt(2) on the trunk, 0.01 on the output heads).

§Entry points

  • MlpBurnPolicy::new — the simple scout-era constructor (random Kaiming init, 2 layers).
  • MlpBurnConfig — builder-style configuration with orthogonal init, activation, and depth knobs; supports the encoder-tap helper that downstream regularizers want.

§Why generic over B: Backend?

Burn’s idiomatic pattern is to make every Module generic over a Backend type parameter (CPU NdArray, GPU Wgpu/Cuda, autodiff-decorated variants, etc.). Production trainers can re-use the same modules with a different backend at the top of the binary without touching the policy code.

Structs§

MlpBurnConfig
Configuration for MlpBurnPolicy architecture.
MlpBurnPolicy
Two- or three-layer MLP actor-critic for discrete action spaces, ported to Burn.
MlpBurnPolicyRecord
The record type for the module.
MlpBurnPolicyRecordItem
The record item type for the module.

Enums§

BurnActivation
Activation function applied between hidden layers in MlpBurnPolicy (and its multi-discrete sibling).