allow tuple action space (#11429)

Co-authored-by: Jiajie Xiao <jj@Jiajies-MBP-2.attlocal.net>
This commit is contained in:
Jiajie XiaoandJiajie Xiao authored and GitHub committed 2020-10-29 16:05:38 +01:00
1 parent 91fa7e0b4e
commit 0b07af374a
2 files changed
+8 -2

No files matched your search

+4 -1
View File
@@ -113,7 +113,10 @@ class LSTMWrapper(RecurrentNetwork):
self.cell_size = model_config["lstm_cell_size"]
self.use_prev_action_reward = model_config[
"lstm_use_prev_action_reward"]
self.action_dim = int(np.product(action_space.shape))
if action_space.shape is not None:
self.action_dim = int(np.product(action_space.shape))
else:
self.action_dim = int(len(action_space))
# Add prev-action/reward nodes to input to LSTM.
if self.use_prev_action_reward:
self.num_outputs += 1 + self.action_dim
+4 -1
View File
@@ -114,7 +114,10 @@ class LSTMWrapper(RecurrentNetwork, nn.Module):
self.time_major = model_config.get("_time_major", False)
self.use_prev_action_reward = model_config[
"lstm_use_prev_action_reward"]
self.action_dim = int(np.product(action_space.shape))
if action_space.shape is not None:
self.action_dim = int(np.product(action_space.shape))
else:
self.action_dim = int(len(action_space))
# Add prev-action/reward nodes to input to LSTM.
if self.use_prev_action_reward:
self.num_outputs += 1 + self.action_dim