File tree Expand file tree Collapse file tree 7 files changed +33
-0
lines changed Expand file tree Collapse file tree 7 files changed +33
-0
lines changed Original file line number Diff line number Diff line change 16
16
import numpy as np
17
17
import matplotlib .pyplot as plt
18
18
19
+ if len (K .tensorflow_backend ._get_available_gpus ()) > 0 :
20
+ from keras .layers import CuDNNLSTM as LSTM
21
+ from keras .layers import CuDNNGRU as GRU
22
+
19
23
20
24
# make sure we do softmax over the time axis
21
25
# expected shape is N x T x D
Original file line number Diff line number Diff line change 13
13
import pandas as pd
14
14
import matplotlib .pyplot as plt
15
15
16
+ if len (K .tensorflow_backend ._get_available_gpus ()) > 0 :
17
+ from keras .layers import CuDNNLSTM as LSTM
18
+ from keras .layers import CuDNNGRU as GRU
19
+
16
20
17
21
def get_mnist (limit = None ):
18
22
if not os .path .exists ('../large_files' ):
Original file line number Diff line number Diff line change 9
9
import numpy as np
10
10
import matplotlib .pyplot as plt
11
11
12
+ import keras .backend as K
13
+ if len (K .tensorflow_backend ._get_available_gpus ()) > 0 :
14
+ from keras .layers import CuDNNLSTM as LSTM
15
+ from keras .layers import CuDNNGRU as GRU
16
+
12
17
13
18
T = 8
14
19
D = 2
Original file line number Diff line number Diff line change 19
19
from keras .optimizers import Adam
20
20
from sklearn .metrics import roc_auc_score
21
21
22
+ import keras .backend as K
23
+ if len (K .tensorflow_backend ._get_available_gpus ()) > 0 :
24
+ from keras .layers import CuDNNLSTM as LSTM
25
+ from keras .layers import CuDNNGRU as GRU
26
+
22
27
23
28
# Download the data:
24
29
# https://www.kaggle.com/c/jigsaw-toxic-comment-classification-challenge
Original file line number Diff line number Diff line change 17
17
from keras .preprocessing .sequence import pad_sequences
18
18
from keras .optimizers import Adam , SGD
19
19
20
+ import keras .backend as K
21
+ if len (K .tensorflow_backend ._get_available_gpus ()) > 0 :
22
+ from keras .layers import CuDNNLSTM as LSTM
23
+ from keras .layers import CuDNNGRU as GRU
24
+
20
25
21
26
# some configuration
22
27
MAX_SEQUENCE_LENGTH = 100
Original file line number Diff line number Diff line change 9
9
import numpy as np
10
10
import matplotlib .pyplot as plt
11
11
12
+ import keras .backend as K
13
+ if len (K .tensorflow_backend ._get_available_gpus ()) > 0 :
14
+ from keras .layers import CuDNNLSTM as LSTM
15
+ from keras .layers import CuDNNGRU as GRU
16
+
12
17
13
18
T = 8
14
19
D = 2
Original file line number Diff line number Diff line change 15
15
import numpy as np
16
16
import matplotlib .pyplot as plt
17
17
18
+ import keras .backend as K
19
+ if len (K .tensorflow_backend ._get_available_gpus ()) > 0 :
20
+ from keras .layers import CuDNNLSTM as LSTM
21
+ from keras .layers import CuDNNGRU as GRU
22
+
18
23
19
24
# some config
20
25
BATCH_SIZE = 64 # Batch size for training.
You can’t perform that action at this time.
0 commit comments