MCPcopy Create free account
hub / github.com/Kaggle/docker-python / test_lstm

Method test_lstm

tests/test_tensorflow.py:49–68  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

47 self.assertTrue(os.path.isfile("tf_plot_model.png"))
48
49 def test_lstm(self):
50 x_train = np.random.random((100, 28, 28))
51 y_train = np.random.randint(10, size=(100, 1))
52 x_test = np.random.random((20, 28, 28))
53 y_test = np.random.randint(10, size=(20, 1))
54
55 model = tf.keras.Sequential([
56 tf.keras.layers.Bidirectional(tf.keras.layers.LSTM(64, input_shape=(28, 28))),
57 tf.keras.layers.Dense(64, activation='relu'),
58 tf.keras.layers.Dense(1, activation='sigmoid')
59 ])
60
61 model.compile(
62 loss='binary_crossentropy',
63 optimizer='adam',
64 metrics=['accuracy'])
65
66 model.fit(x_train, y_train, epochs=1)
67 result = model.evaluate(x_test, y_test)
68 self.assertEqual(2, len(result))
69
70 @gpu_test
71 def test_gpu(self):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected