QDpy
Loading...
Searching...
No Matches
qdpy.rl.policy.CategoricalPolicy Class Reference

A categorical actor that can run independently of its training environment. More...

Inheritance diagram for qdpy.rl.policy.CategoricalPolicy:
qdpy.rl.policy._FlatPolicy

Public Member Functions

 save (self, path)
 Export actor parameters and the information needed to decode actions.
 load (cls, path, *, device="cpu", seed=0)
 Rebuild an inference actor from a versioned, numeric policy artifact.
Public Member Functions inherited from qdpy.rl.policy._FlatPolicy
 act (self, observation, deterministic=True)
 Choose a deterministic action or sample from the actor.

Detailed Description

A categorical actor that can run independently of its training environment.

Map finite Box observations to valid discrete controller actions.

Each component of a MultiDiscrete action has its own categorical
distribution. Observations are flattened in C order and converted to
float32. The actor stores no value function or optimiser state.

:param observation_space: Numeric Gymnasium Box, with a fixed shape.
:param action_space: Discrete or unmasked MultiDiscrete space.
:param config: Optional :class:`PolicyConfig` with hidden-layer widths.
:param seed: Nonnegative seed for initialization and stochastic actions.
:param device: Torch CPU or CUDA device.

Definition at line 222 of file policy.py.

Member Function Documentation

◆ load()

qdpy.rl.policy.CategoricalPolicy.load ( cls,
path,
* ,
device = "cpu",
seed = 0 )

Rebuild an inference actor from a versioned, numeric policy artifact.

Load a saved actor without instantiating its training environment.

Definition at line 281 of file policy.py.

◆ save()

qdpy.rl.policy.CategoricalPolicy.save ( self,
path )

Export actor parameters and the information needed to decode actions.

Write a versioned NumPy archive to the supplied filename.

Definition at line 272 of file policy.py.


The documentation for this class was generated from the following file: