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
c93ac621
Unverified
Commit
c93ac621
authored
Mar 31, 2020
by
Yichao 'Peak' Ji
Committed by
GitHub
Mar 31, 2020
Browse files
Fix output shape of the position embedding layer
parent
6d7030f2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
official/nlp/modeling/layers/position_embedding.py
official/nlp/modeling/layers/position_embedding.py
+5
-5
No files found.
official/nlp/modeling/layers/position_embedding.py
View file @
c93ac621
...
...
@@ -116,10 +116,10 @@ class PositionEmbedding(tf.keras.layers.Layer):
seq_length
=
input_shape
[
1
]
width
=
input_shape
[
2
]
position_embeddings
=
tf
.
expand_dims
(
tf
.
slice
(
self
.
_position_embeddings
,
[
0
,
0
],
[
seq_length
,
width
])
,
axis
=
0
)
position_embeddings
=
tf
.
slice
(
self
.
_position_embeddings
,
[
0
,
0
]
,
[
seq_length
,
width
]
)
else
:
position_embeddings
=
tf
.
expand_dims
(
self
.
_position_embeddings
,
axis
=
0
)
position_embeddings
=
self
.
_position_embeddings
return
position_embeddings
return
tf
.
broadcast_to
(
position_embeddings
,
input_shape
)
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