Skip to content

Instantly share code, notes, and snippets.

@wezleysherman
Created July 31, 2020 05:07
Show Gist options
  • Save wezleysherman/b67f65a942115cb125f8fe511c0e3adf to your computer and use it in GitHub Desktop.
Save wezleysherman/b67f65a942115cb125f8fe511c0e3adf to your computer and use it in GitHub Desktop.
# GRU
D = 512
T = train_X.shape[1]
i = Input(shape=(T,))
x = Embedding(V + 1, D)(i)
x = Dropout(0.2)(x)
x = Bidirectional(GRU(150))(x)
x = Dense(V, activation="softmax")(x)
gru_model = Model(i, x)
gru_model.summary()
adam = tf.keras.optimizers.Adam(learning_rate=0.001)
gru_model.compile(optimizer=adam, metrics=["accuracy"], loss="categorical_crossentropy")
gru_r = gru_model.fit(train_X, train_y, epochs=50)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment