@@ -231,10 +231,8 @@ def __init__(self, params):
231231 # We should NOT modify the list itself. This would break the
232232 # hyperparameter algorithms.
233233 use_only_one_activation_type = False
234- if len (self .params .layer_activations ) == 1 :
234+ if type (self .params .layer_activations ) == str :
235235 use_only_one_activation_type = True
236- elif len (self .params .layer_activations ) < self .number_of_layers :
237- raise Exception ("Not enough activation layers provided." )
238236 elif len (self .params .layer_activations ) > self .number_of_layers :
239237 printout (
240238 "Too many activation layers provided. The last" ,
@@ -246,7 +244,7 @@ def __init__(self, params):
246244 )
247245
248246 # Add the layers.
249- # As this is a feedforward layer we always add linear layers, and then
247+ # As this is a feedforward NN we always add linear layers, and then
250248 # an activation function
251249 for i in range (0 , self .number_of_layers ):
252250 self .layers .append (
@@ -261,7 +259,7 @@ def __init__(self, params):
261259 if use_only_one_activation_type :
262260 self .layers .append (
263261 self ._activation_mappings [
264- self .params .layer_activations [ 0 ]
262+ self .params .layer_activations
265263 ]()
266264 )
267265 else :
@@ -272,6 +270,9 @@ def __init__(self, params):
272270 )
273271 except KeyError :
274272 raise Exception ("Invalid activation type seleceted." )
273+ except IndexError :
274+ # Layer without activation
275+ pass
275276
276277 # Once everything is done, we can move the Network on the target
277278 # device.
0 commit comments