Skip to content

Commit

Permalink
Bug fix multiple observations
Browse files Browse the repository at this point in the history
  • Loading branch information
awjuliani committed Jan 19, 2018
1 parent a1d35bf commit ecdbbd7
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions python/ppo/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,12 @@ def __init__(self, lr, brain, h_size, epsilon, max_step, normalize, num_layers):

hidden_state, hidden_visual, hidden_policy, hidden_value = None, None, None, None
encoders = []
for i in range(brain.number_observations):
height_size, width_size = brain.camera_resolutions[i]['height'], brain.camera_resolutions[i]['width']
bw = brain.camera_resolutions[i]['blackAndWhite']
encoders.append(self.create_visual_encoder(height_size, width_size, bw, h_size, 2, tf.nn.tanh, num_layers))
hidden_visual = tf.concat(encoders, axis=2)
if brain.number_observations > 0:
for i in range(brain.number_observations):
height_size, width_size = brain.camera_resolutions[i]['height'], brain.camera_resolutions[i]['width']
bw = brain.camera_resolutions[i]['blackAndWhite']
encoders.append(self.create_visual_encoder(height_size, width_size, bw, h_size, 2, tf.nn.tanh, num_layers))
hidden_visual = tf.concat(encoders, axis=2)
if brain.state_space_size > 0:
s_size = brain.state_space_size
if brain.state_space_type == "continuous":
Expand Down Expand Up @@ -278,12 +279,13 @@ def __init__(self, lr, brain, h_size, epsilon, beta, max_step, normalize, num_la
self.normalize = normalize

hidden_state, hidden_visual, hidden = None, None, None
encoders = []
for i in range(brain.number_observations):
height_size, width_size = brain.camera_resolutions[i]['height'], brain.camera_resolutions[i]['width']
bw = brain.camera_resolutions[i]['blackAndWhite']
encoders.append(self.create_visual_encoder(height_size, width_size, bw, h_size, 1, tf.nn.elu, num_layers)[0])
hidden_visual = tf.concat(encoders, axis=1)
if brain.number_observations > 0:
encoders = []
for i in range(brain.number_observations):
height_size, width_size = brain.camera_resolutions[i]['height'], brain.camera_resolutions[i]['width']
bw = brain.camera_resolutions[i]['blackAndWhite']
encoders.append(self.create_visual_encoder(height_size, width_size, bw, h_size, 1, tf.nn.elu, num_layers)[0])
hidden_visual = tf.concat(encoders, axis=1)
if brain.state_space_size > 0:
s_size = brain.state_space_size
if brain.state_space_type == "continuous":
Expand Down

0 comments on commit ecdbbd7

Please sign in to comment.