@@ -215,11 +215,12 @@ def __init__(self, lr, brain, h_size, epsilon, max_step, normalize, num_layers):
215
215
216
216
hidden_state , hidden_visual , hidden_policy , hidden_value = None , None , None , None
217
217
encoders = []
218
- for i in range (brain .number_observations ):
219
- height_size , width_size = brain .camera_resolutions [i ]['height' ], brain .camera_resolutions [i ]['width' ]
220
- bw = brain .camera_resolutions [i ]['blackAndWhite' ]
221
- encoders .append (self .create_visual_encoder (height_size , width_size , bw , h_size , 2 , tf .nn .tanh , num_layers ))
222
- hidden_visual = tf .concat (encoders , axis = 2 )
218
+ if brain .number_observations > 0 :
219
+ for i in range (brain .number_observations ):
220
+ height_size , width_size = brain .camera_resolutions [i ]['height' ], brain .camera_resolutions [i ]['width' ]
221
+ bw = brain .camera_resolutions [i ]['blackAndWhite' ]
222
+ encoders .append (self .create_visual_encoder (height_size , width_size , bw , h_size , 2 , tf .nn .tanh , num_layers ))
223
+ hidden_visual = tf .concat (encoders , axis = 2 )
223
224
if brain .state_space_size > 0 :
224
225
s_size = brain .state_space_size
225
226
if brain .state_space_type == "continuous" :
@@ -278,12 +279,13 @@ def __init__(self, lr, brain, h_size, epsilon, beta, max_step, normalize, num_la
278
279
self .normalize = normalize
279
280
280
281
hidden_state , hidden_visual , hidden = None , None , None
281
- encoders = []
282
- for i in range (brain .number_observations ):
283
- height_size , width_size = brain .camera_resolutions [i ]['height' ], brain .camera_resolutions [i ]['width' ]
284
- bw = brain .camera_resolutions [i ]['blackAndWhite' ]
285
- encoders .append (self .create_visual_encoder (height_size , width_size , bw , h_size , 1 , tf .nn .elu , num_layers )[0 ])
286
- hidden_visual = tf .concat (encoders , axis = 1 )
282
+ if brain .number_observations > 0 :
283
+ encoders = []
284
+ for i in range (brain .number_observations ):
285
+ height_size , width_size = brain .camera_resolutions [i ]['height' ], brain .camera_resolutions [i ]['width' ]
286
+ bw = brain .camera_resolutions [i ]['blackAndWhite' ]
287
+ encoders .append (self .create_visual_encoder (height_size , width_size , bw , h_size , 1 , tf .nn .elu , num_layers )[0 ])
288
+ hidden_visual = tf .concat (encoders , axis = 1 )
287
289
if brain .state_space_size > 0 :
288
290
s_size = brain .state_space_size
289
291
if brain .state_space_type == "continuous" :
0 commit comments