Created
August 17, 2019 14:26
-
-
Save NMZivkovic/dfd88db6d2da75203e7ffd58627cd0cd to your computer and use it in GitHub Desktop.
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
def build_multi_head_attention_layers(num_neurons, num_heads): | |
multi_head_attention_layer = MultiHeadAttentionLayer(num_neurons, num_heads) | |
dropout = tf.keras.layers.Dropout(0.1) | |
normalization = LayerNormalization(epsilon=1e-6) | |
return multi_head_attention_layer, dropout, normalization | |
def build_feed_forward_layers(num_neurons, num_hidden_neurons): | |
feed_forward_layer = tf.keras.Sequential() | |
feed_forward_layer.add(Dense(num_hidden_neurons, activation='relu')) | |
feed_forward_layer.add(Dense(num_neurons)) | |
dropout = Dropout(0.1) | |
normalization = LayerNormalization(epsilon=1e-6) | |
return feed_forward_layer, dropout, normalization |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment