OneStepModel#
- class torchrl.modules.OneStepModel(network: Module, action_dim: int, *, low: float | Tensor = -1.0, high: float | Tensor = 1.0)[source]#
Tensor-only network for one-step flow distillation.
- Parameters:
network (nn.Module) – maps concatenated observation and Gaussian noise directly to an action, without an output activation.
action_dim (int) – number of action coordinates.
- Keyword Arguments:
OneStepPolicyprovides the TensorDict interface. Outputs are clipped to[low, high]. Both models sample Gaussian noise even under deterministic exploration; pass explicit noise for repeatability.- forward(observation: Tensor, noise: Tensor | None = None, *, clamp: bool = True) Tensor[source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.