text_plain_output_1.png
from tensorflow.keras import layers

import numpy as np # linear algebra

sent_lens = [len(sentence.split()) for sentence in train_sentences]
sent_lens[:10]

avg_len = np.mean(sent_lens)
avg_len

out_len_seq = np.percentile(sent_lens, 95)
out_len_seq

max_tokens = 65000
output_sequence_length = int(out_len_seq)

embedding = layers.Embedding(input_dim=max_tokens, output_dim=128, input_length=out_len_seq, embeddings_initializer='uniform')
embedding