mirror of
https://github.com/wassname/ray.git
synced 2026-07-17 11:32:33 +08:00
allow tuple action space (#11429)
Co-authored-by: Jiajie Xiao <jj@Jiajies-MBP-2.attlocal.net>
This commit is contained in:
co-authored by
Jiajie Xiao
parent
91fa7e0b4e
commit
0b07af374a
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user