Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ModelZoo
ResNet50_tensorflow
Commits
a0b4cdb6
Commit
a0b4cdb6
authored
Aug 25, 2020
by
A. Unique TensorFlower
Browse files
Get the handle of self._embedding_norm_layer for future weight copying.
PiperOrigin-RevId: 328364661
parent
42b49ff1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
6 deletions
+4
-6
official/nlp/modeling/networks/transformer_encoder.py
official/nlp/modeling/networks/transformer_encoder.py
+4
-6
No files found.
official/nlp/modeling/networks/transformer_encoder.py
View file @
a0b4cdb6
...
@@ -153,12 +153,10 @@ class TransformerEncoder(tf.keras.Model):
...
@@ -153,12 +153,10 @@ class TransformerEncoder(tf.keras.Model):
embeddings
=
tf
.
keras
.
layers
.
Add
()(
embeddings
=
tf
.
keras
.
layers
.
Add
()(
[
word_embeddings
,
position_embeddings
,
type_embeddings
])
[
word_embeddings
,
position_embeddings
,
type_embeddings
])
embeddings
=
(
self
.
_embedding_norm_layer
=
tf
.
keras
.
layers
.
LayerNormalization
(
tf
.
keras
.
layers
.
LayerNormalization
(
name
=
'embeddings/layer_norm'
,
axis
=-
1
,
epsilon
=
1e-12
,
dtype
=
tf
.
float32
)
name
=
'embeddings/layer_norm'
,
axis
=-
1
,
embeddings
=
self
.
_embedding_norm_layer
(
embeddings
)
epsilon
=
1e-12
,
dtype
=
tf
.
float32
)(
embeddings
))
embeddings
=
(
tf
.
keras
.
layers
.
Dropout
(
rate
=
dropout_rate
)(
embeddings
))
embeddings
=
(
tf
.
keras
.
layers
.
Dropout
(
rate
=
dropout_rate
)(
embeddings
))
# We project the 'embedding' output to 'hidden_size' if it is not already
# We project the 'embedding' output to 'hidden_size' if it is not already
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment