Skip to content

Instantly share code, notes, and snippets.

@pythonlessons
Created August 22, 2023 14:47
Show Gist options
  • Save pythonlessons/271ef12378f045e9c011204b7f45694a to your computer and use it in GitHub Desktop.
Save pythonlessons/271ef12378f045e9c011204b7f45694a to your computer and use it in GitHub Desktop.
build_transformer
# Test DecoderLayer layer
decoder_vocab_size = 1000
d_model = 512
dff = 2048
num_heads = 8
decoder_layer = DecoderLayer(d_model, num_heads, dff)
random_decoderLayer_input = np.random.randint(0, decoder_vocab_size, size=(1, 110))
decoder_embeddings = encoder_embedding_layer(random_decoderLayer_input)
decoderLayer_output = decoder_layer(decoder_embeddings, encoder_output)
print("random_decoder_input shape", random_decoderLayer_input.shape)
print("decoder_embeddings shape", decoder_embeddings.shape)
print("decoder_output shape", decoderLayer_output.shape)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment