Created
August 22, 2023 14:47
-
-
Save pythonlessons/380ec1b1668fe74bcff862cd7a2fc12e to your computer and use it in GitHub Desktop.
build_transformer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
encoder_vocab_size = 1000 | |
d_model = 512 | |
encoder = Encoder(num_layers=2, d_model=d_model, num_heads=2, dff=2048, vocab_size=encoder_vocab_size) | |
random_encoder_input = np.random.randint(0, encoder_vocab_size, size=(1, 100)) | |
encoder_output = encoder(random_encoder_input) | |
print("random_encoder_input shape", random_encoder_input.shape) | |
print("encoder_output shape", encoder_output.shape) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment