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
71a6b899
Commit
71a6b899
authored
Mar 03, 2022
by
A. Unique TensorFlower
Browse files
Internal change
PiperOrigin-RevId: 432311587
parent
b136d845
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
1 deletion
+2
-1
official/nlp/modeling/layers/masked_lm.py
official/nlp/modeling/layers/masked_lm.py
+2
-1
No files found.
official/nlp/modeling/layers/masked_lm.py
View file @
71a6b899
...
@@ -115,7 +115,8 @@ class MaskedLM(tf.keras.layers.Layer):
...
@@ -115,7 +115,8 @@ class MaskedLM(tf.keras.layers.Layer):
flat_offsets
=
tf
.
reshape
(
flat_offsets
=
tf
.
reshape
(
tf
.
range
(
0
,
batch_size
,
dtype
=
tf
.
int32
)
*
seq_length
,
[
-
1
,
1
])
tf
.
range
(
0
,
batch_size
,
dtype
=
tf
.
int32
)
*
seq_length
,
[
-
1
,
1
])
flat_positions
=
tf
.
reshape
(
positions
+
flat_offsets
,
[
-
1
])
flat_positions
=
tf
.
reshape
(
positions
+
tf
.
cast
(
flat_offsets
,
positions
.
dtype
),
[
-
1
])
flat_sequence_tensor
=
tf
.
reshape
(
sequence_tensor
,
flat_sequence_tensor
=
tf
.
reshape
(
sequence_tensor
,
[
batch_size
*
seq_length
,
width
])
[
batch_size
*
seq_length
,
width
])
output_tensor
=
tf
.
gather
(
flat_sequence_tensor
,
flat_positions
)
output_tensor
=
tf
.
gather
(
flat_sequence_tensor
,
flat_positions
)
...
...
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