|
5 | 5 | Dense, Activation, Dropout, Lambda, |
6 | 6 | Reshape, Flatten, Permute, # RepeatVector |
7 | 7 | ) |
8 | | -from keras.layers import LSTM, SimpleRNN, Bidirectional, BatchNormalization |
| 8 | +from keras.layers import LSTM, SimpleRNN, BatchNormalization |
9 | 9 | from keras.layers.convolutional import Convolution1D |
10 | 10 | from keras.layers.pooling import MaxPooling1D |
11 | 11 | # from keras.utils.data_utils import get_file |
@@ -82,7 +82,6 @@ def build_model(self, predict, custom_batch_size=None): |
82 | 82 | conf = self.conf |
83 | 83 | model_conf = conf['model'] |
84 | 84 | rnn_size = model_conf['rnn_size'] |
85 | | - use_bidirectional = model_conf['use_bidirectional'] |
86 | 85 | rnn_type = model_conf['rnn_type'] |
87 | 86 | regularization = model_conf['regularization'] |
88 | 87 | dense_regularization = model_conf['dense_regularization'] |
@@ -249,33 +248,15 @@ def slicer_output_shape(input_shape, indices): |
249 | 248 | # pre_rnn_model.summary() |
250 | 249 | x_input = Input(batch_shape=batch_input_shape) |
251 | 250 | x_in = TimeDistributed(pre_rnn_model)(x_input) |
252 | | - |
253 | | - if use_bidirectional: |
254 | | - for _ in range(model_conf['rnn_layers']): |
255 | | - x_in = Bidirectional( |
256 | | - rnn_model( |
257 | | - rnn_size, |
258 | | - return_sequences=return_sequences, |
259 | | - stateful=stateful, |
260 | | - kernel_regularizer=l2(regularization), |
261 | | - recurrent_regularizer=l2(regularization), |
262 | | - bias_regularizer=l2(regularization), |
263 | | - dropout=dropout_prob, |
264 | | - recurrent_dropout=dropout_prob))(x_in) |
265 | | - x_in = Dropout(dropout_prob)(x_in) |
266 | | - else: |
267 | | - for _ in range(model_conf['rnn_layers']): |
268 | | - x_in = rnn_model( |
269 | | - rnn_size, |
270 | | - return_sequences=return_sequences, |
271 | | - # batch_input_shape=batch_input_shape, |
272 | | - stateful=stateful, |
273 | | - kernel_regularizer=l2(regularization), |
274 | | - recurrent_regularizer=l2(regularization), |
275 | | - bias_regularizer=l2(regularization), |
276 | | - dropout=dropout_prob, |
277 | | - recurrent_dropout=dropout_prob)(x_in) |
278 | | - x_in = Dropout(dropout_prob)(x_in) |
| 251 | + for _ in range(model_conf['rnn_layers']): |
| 252 | + x_in = rnn_model( |
| 253 | + rnn_size, return_sequences=return_sequences, |
| 254 | + # batch_input_shape=batch_input_shape, |
| 255 | + stateful=stateful, kernel_regularizer=l2(regularization), |
| 256 | + recurrent_regularizer=l2(regularization), |
| 257 | + bias_regularizer=l2(regularization), dropout=dropout_prob, |
| 258 | + recurrent_dropout=dropout_prob)(x_in) |
| 259 | + x_in = Dropout(dropout_prob)(x_in) |
279 | 260 | if return_sequences: |
280 | 261 | # x_out = TimeDistributed(Dense(100,activation='tanh')) (x_in) |
281 | 262 | x_out = TimeDistributed( |
|
0 commit comments