Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed the problem of the reset function of Memory corresponding to actor_critic_recurrent #35

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion rsl_rl/modules/actor_critic_recurrent.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,5 +93,7 @@ def forward(self, input, masks=None, hidden_states=None):

def reset(self, dones=None):
# When the RNN is an LSTM, self.hidden_states_a is a list with hidden_state and cell_state
# dones: (num_envs,), hidden_states: (num_layers, num_envs, hidden_size)
dones_envs_id = torch.where(dones)[0] if dones else None
for hidden_state in self.hidden_states:
hidden_state[..., dones, :] = 0.0
hidden_state[..., dones_envs_id, :] = 0.0