Shortcuts

torchrl.trainers.algorithms.configs.modules.MLPConfig

class torchrl.trainers.algorithms.configs.modules.MLPConfig(_partial_: bool = False, in_features: int | None = None, out_features: Any = None, depth: int | None = None, num_cells: Any = None, activation_class: ActivationConfig = <factory>, activation_kwargs: Any = None, norm_class: Any = None, norm_kwargs: Any = None, dropout: float | None = None, bias_last_layer: bool = True, single_bias_last_layer: bool = False, layer_class: LayerConfig = <factory>, layer_kwargs: dict | None = None, activate_last_layer: bool = False, device: Any = None, _target_: str = 'torchrl.modules.MLP')[source]

A class to configure a multi-layer perceptron.

Example

>>> cfg = MLPConfig(in_features=10, out_features=5, depth=2, num_cells=32)
>>> net = instantiate(cfg)
>>> y = net(torch.randn(1, 10))
>>> assert y.shape == (1, 5)

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources