Skip to content

Instantly share code, notes, and snippets.

@edumunozsala
Created October 11, 2020 16:07
Show Gist options
  • Save edumunozsala/3aeb88d9c93df1f1bd3f67f810708f33 to your computer and use it in GitHub Desktop.
Save edumunozsala/3aeb88d9c93df1f1bd3f67f810708f33 to your computer and use it in GitHub Desktop.
Padding the input, target and target input sequence for the seq2seq model
# pad the input sequences
encoder_inputs = pad_sequences(input_sequences, maxlen=input_max_len, padding='post')
print("encoder_inputs.shape:", encoder_inputs.shape)
print("encoder_inputs[0]:", encoder_inputs[0])
# pad the decoder input sequences
decoder_inputs = pad_sequences(target_sequences_inputs, maxlen=target_max_len, padding='post')
print("decoder_inputs[0]:", decoder_inputs[0])
print("decoder_inputs.shape:", decoder_inputs.shape)
# pad the target output sequences
decoder_targets = pad_sequences(target_sequences, maxlen=target_max_len, padding='post')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment