Skip to content

Instantly share code, notes, and snippets.

@NMZivkovic
Created August 3, 2019 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NMZivkovic/5289255cd3b3cd51509aa182a97ecfeb to your computer and use it in GitHub Desktop.
Save NMZivkovic/5289255cd3b3cd51509aa182a97ecfeb to your computer and use it in GitHub Desktop.
maskHandler = MaskHandler()
x = tf.constant([[1, 2, 0, 0, 6], [1, 1, 1, 0, 0], [0, 0, 0, 6, 9]])
mask = maskHandler.padding_mask(x)
print("Padding Mask Example:")
print("-----------")
print(mask)
print("-----------")
x = tf.random.uniform((1, 3))
mask = maskHandler.look_ahead_mask(x.shape[1])
print("Look Ahead Mask Example:")
print("-----------")
print(mask)
print("-----------")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment