OffPolicyStochActorDoubleCritic
OffPolicyStochActorDoubleCritic(
observation_space: gym.Space, action_space: gym.Space, feature_dim: int = 64,
hidden_dim: int = 1024, opt_class: Type[th.optim.Optimizer] = th.optim.Adam,
opt_kwargs: Optional[Dict[str, Any]] = None, log_std_range: Tuple = (-5, 2),
init_fn: str = 'orthogonal'
)
Stochastic actor network and double critic network for off-policy algortithms like SAC
.
Here the 'self.dist' refers to an sampling distribution instance.
Args
- observation_space (gym.Space) : Observation space.
- action_space (gym.Space) : Action space.
- feature_dim (int) : Number of features accepted.
- hidden_dim (int) : Number of units per hidden layer.
- opt_class (Type[th.optim.Optimizer]) : Optimizer class.
- opt_kwargs (Dict[str, Any]) : Optimizer keyword arguments.
- log_std_range (Tuple) : Range of log standard deviation.
- init_fn (str) : Parameters initialization method.
Returns
Actor-Critic network.
Methods:
.describe
Describe the policy.
.freeze
Freeze all the elements like encoder
and dist
.
Args
- encoder (nn.Module) : Encoder network.
- dist (Distribution) : Distribution class.
Returns
None.
.forward
Sample actions based on observations.
Args
- obs (th.Tensor) : Observations.
- training (bool) : Training mode, True or False.
Returns
Sampled actions.
.get_dist
Get sample distribution.
Args
- obs (th.Tensor) : Observations.
- step (int) : Global training step.
Returns
Action distribution.
.save
Save models.
Args
- path (Path) : Save path.
- pretraining (bool) : Pre-training mode.
- global_step (int) : Global training step.
Returns
None.