Skip to content

Commit e8302b6

Browse files
committed
update docs for actor/critic output customization
1 parent 350e1fd commit e8302b6

3 files changed

Lines changed: 19 additions & 5 deletions

File tree

amago/agent.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,8 @@ def V(state, critic, action_dist, k) -> float:
194194
use_target_actor: If True, use a target actor to sample actions used in TD targets.
195195
Defaults to True.
196196
use_multigamma: If True, train on multiple discount horizons (:py:class:`~amago.agent.Multigammas`) in parallel. Defaults to True.
197+
actor_type: Actor MLP head for producing action distributions. Defaults to :py:class:`~amago.nets.actor_critic.Actor`.
198+
critic_type: Critic MLP head for producing Q-values. Defaults to :py:class:`~amago.nets.actor_critic.NCritics`.
197199
"""
198200

199201
def __init__(
@@ -708,7 +710,7 @@ class MultiTaskAgent(Agent):
708710
709711
The combination of points 2 and 3 stresses accurate advantage estimates and motivates a change
710712
in the default value of num_actions_for_value_in_critic_loss from 1 --> 3. Arguments otherwise
711-
follow the information listed in amago.agent.Agent.
713+
follow the information listed in :py:class:`~amago.agent.Agent`.
712714
"""
713715

714716
def __init__(

amago/nets/actor_critic.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,9 +309,7 @@ def forward(
309309
self, state: torch.Tensor, action: torch.Tensor, log_dict: Optional[dict] = None
310310
) -> torch.Tensor:
311311
assert state.ndim == 3
312-
B, L, _ = state.shape
313312
assert action.ndim == 5
314-
K = action.shape[0]
315313
out = self.critic_network_forward(state=state, action=action, log_dict=log_dict)
316314
return out
317315

docs/tutorial/customization.rst

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,20 @@ RLDataset
107107

108108
**Implement**: :py:class:`~amago.nets.policy_dists.PolicyOutput`
109109

110-
**Substitute**: ``config = {"amago.nets.actor_critic.Actor.continuous_dist_type" : MyPolicyOutput, ...}; use_config(config); experiment = Experiment(...)``
110+
**Configure**: ``config = {"amago.nets.actor_critic.Actor.continuous_dist_type" : MyPolicyOutput, ...}; use_config(config); experiment = Experiment(...)``
111111

112-
|
112+
|
113+
114+
Actor Output Head
115+
~~~~~~~~~~~~~~~~~~~
116+
**Implement** :py:class:`~amago.nets.actor_critic.BaseActorHead`
117+
118+
**Configure**: ``Agent.actor_type : MyActor``
119+
120+
|
121+
122+
Critic Output Head
123+
~~~~~~~~~~~~~~~~~~~
124+
**Implement** : :py:class:`~amago.nets.actor_critic.BaseCriticHead`
125+
126+
**Configure**: ``Agent.critic_type : MyCritic``

0 commit comments

Comments
 (0)