Skip to content

Instantly share code, notes, and snippets.

@amankharwal

amankharwal/Title Generator Secret

Created Oct 5, 2020
Embed
What would you like to do?
def generate_padded_sequences(input_sequences):
max_sequence_len = max([len(x) for x in input_sequences])
input_sequences = np.array(pad_sequences(input_sequences, maxlen=max_sequence_len, padding=’pre’))
predictors, label = input_sequences[:,:-1], input_sequences[:, -1]
label = ku.to_categorical(label, num_classes = total_words)
return predictors, label, max_sequence_len
predictors, label, max_sequence_len = generate_padded_sequences(inp_sequences)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment