Created
August 10, 2023 13:19
-
-
Save pythonlessons/e845a977db9b37c5aa10c8ca14cdff97 to your computer and use it in GitHub Desktop.
transformers_introduction
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
| import matplotlib.pyplot as plt | |
| pos_encoding = positional_encoding(length=2048, depth=512) | |
| # Check the shape. | |
| print(pos_encoding.shape) | |
| # Plot the dimensions. | |
| plt.pcolormesh(pos_encoding.numpy().T, cmap='RdBu') | |
| plt.ylabel('Depth') | |
| plt.xlabel('Position') | |
| plt.colorbar() | |
| plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment