Skip to content

Instantly share code, notes, and snippets.

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