<jupyter_start><jupyter_text><jupyter_code>import tensorflow as tf
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import  Dense, Dropout
from tensorflow.compat.v1.keras.layers import CuDNNLSTM

mnist=tf.keras.datasets.mnist
(x_train,y_train),(x_test,y_test)= mnist.load_data()

x_train= x_train/255.0
x_test= x_test/255.0

model= Sequential()
model.add(CuDNNLSTM( 128, input_shape=(x_train.shape[1:]), return_sequences=True ))
model.add(Dropout(0.2))

model.add(CuDNNLSTM(128))
model.add(Dropout(0.2))

model.add(Dense(32,activation='relu'))
model.add(Dropout(.2))

model.add(Dense(32,activation='relu'))
model.add(Dropout(.2))

model.add(Dense(10,activation='softmax'))

opt= tf.keras.optimizers.Adam(lr=1e-3,decay=1e-5)

model.compile(loss='sparse_categorical_crossentropy', optimizer=opt, metrics=['accuracy'])

model.fit(x_train, y_train, epochs=3, validation_data=(x_test,y_test))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15889830508474576, 'fraction_numerical': 0.034957627118644065, 'mean_word_length': 8.84375, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '617472', 'license': 'Apache-2.0', 'n_tokens_mistral': 411, 'n_tokens_neox': 387, 'n_words': 47, 'path': 'LSTM.ipynb', 'repo_name': 'gaurav12899/models', 'size': '944'}