@@ -1268,7 +1268,7 @@ def __init__(
12681268 if 'GRU' in cell_fn .__name__ :
12691269 try :
12701270 cell_init_args .pop ('state_is_tuple' )
1271- except :
1271+ except Exception :
12721272 pass
12731273 self .inputs = layer .outputs
12741274
@@ -1278,7 +1278,7 @@ def __init__(
12781278 # Input dimension should be rank 3 [batch_size, n_steps(max), n_features]
12791279 try :
12801280 self .inputs .get_shape ().with_rank (3 )
1281- except :
1281+ except Exception :
12821282 raise Exception ("RNN : Input dimension should be rank 3 : [batch_size, n_steps(max), n_features]" )
12831283
12841284 # Get the batch_size
@@ -1308,7 +1308,7 @@ def __init__(
13081308 raise Exception ("Invalid dropout type (must be a 2-D tuple of " "float)" )
13091309 try :
13101310 DropoutWrapper_fn = tf .contrib .rnn .DropoutWrapper
1311- except :
1311+ except Exception :
13121312 DropoutWrapper_fn = tf .nn .rnn_cell .DropoutWrapper
13131313
13141314 # cell_instance_fn1=cell_instance_fn # HanSheng
@@ -1337,7 +1337,7 @@ def __init__(
13371337 if sequence_length is None :
13381338 try : # TF1.0
13391339 sequence_length = retrieve_seq_length_op (self .inputs if isinstance (self .inputs , tf .Tensor ) else tf .stack (self .inputs ))
1340- except : # TF0.12
1340+ except Exception : # TF0.12
13411341 sequence_length = retrieve_seq_length_op (self .inputs if isinstance (self .inputs , tf .Tensor ) else tf .pack (self .inputs ))
13421342
13431343 if n_layer > 1 :
@@ -1373,7 +1373,7 @@ def __init__(
13731373 # Manage the outputs
13741374 try : # TF1.0
13751375 outputs = tf .concat (outputs , 2 )
1376- except : # TF0.12
1376+ except Exception : # TF0.12
13771377 outputs = tf .concat (2 , outputs )
13781378 if return_last :
13791379 # [batch_size, 2 * n_hidden]
@@ -1386,7 +1386,7 @@ def __init__(
13861386 # 2D Tensor [n_example, 2 * n_hidden]
13871387 try : # TF1.0
13881388 self .outputs = tf .reshape (tf .concat (outputs , 1 ), [- 1 , 2 * n_hidden ])
1389- except : # TF0.12
1389+ except Exception : # TF0.12
13901390 self .outputs = tf .reshape (tf .concat (1 , outputs ), [- 1 , 2 * n_hidden ])
13911391 else :
13921392 # <akara>:
@@ -1546,7 +1546,7 @@ def __init__(
15461546 if 'GRU' in cell_fn .__name__ :
15471547 try :
15481548 cell_init_args .pop ('state_is_tuple' )
1549- except :
1549+ except Exception :
15501550 pass
15511551 # self.inputs = layer.outputs
15521552 logging .info (" [**] Seq2Seq %s: n_hidden:%d cell_fn:%s dropout:%s n_layer:%d" % (self .name , n_hidden , cell_fn .__name__ , dropout , n_layer ))
0 commit comments