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
64c88b24
Commit
64c88b24
authored
Mar 09, 2021
by
Chen Chen
Committed by
A. Unique TensorFlower
Mar 09, 2021
Browse files
Add the output projects layer in the checkpoint items of MultiClsHead.
PiperOrigin-RevId: 361916017
parent
e0e8aa4a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
3 deletions
+4
-3
official/nlp/modeling/layers/cls_head.py
official/nlp/modeling/layers/cls_head.py
+3
-2
official/nlp/modeling/layers/cls_head_test.py
official/nlp/modeling/layers/cls_head_test.py
+1
-1
No files found.
official/nlp/modeling/layers/cls_head.py
View file @
64c88b24
...
@@ -158,5 +158,6 @@ class MultiClsHeads(tf.keras.layers.Layer):
...
@@ -158,5 +158,6 @@ class MultiClsHeads(tf.keras.layers.Layer):
@
property
@
property
def
checkpoint_items
(
self
):
def
checkpoint_items
(
self
):
# TODO(hongkuny): add output projects to the checkpoint items.
items
=
{
self
.
dense
.
name
:
self
.
dense
}
return
{
self
.
dense
.
name
:
self
.
dense
}
items
.
update
({
v
.
name
:
v
for
v
in
self
.
out_projs
})
return
items
official/nlp/modeling/layers/cls_head_test.py
View file @
64c88b24
...
@@ -48,7 +48,7 @@ class MultiClsHeadsTest(tf.test.TestCase):
...
@@ -48,7 +48,7 @@ class MultiClsHeadsTest(tf.test.TestCase):
self
.
assertAllClose
(
outputs
[
"foo"
],
[[
0.
,
0.
],
[
0.
,
0.
]])
self
.
assertAllClose
(
outputs
[
"foo"
],
[[
0.
,
0.
],
[
0.
,
0.
]])
self
.
assertAllClose
(
outputs
[
"bar"
],
[[
0.
,
0.
,
0.
],
[
0.
,
0.
,
0.
]])
self
.
assertAllClose
(
outputs
[
"bar"
],
[[
0.
,
0.
,
0.
],
[
0.
,
0.
,
0.
]])
self
.
assertSameElements
(
test_layer
.
checkpoint_items
.
keys
(),
self
.
assertSameElements
(
test_layer
.
checkpoint_items
.
keys
(),
[
"pooler_dense"
])
[
"pooler_dense"
,
"foo"
,
"bar"
])
def
test_layer_serialization
(
self
):
def
test_layer_serialization
(
self
):
cls_list
=
[(
"foo"
,
2
),
(
"bar"
,
3
)]
cls_list
=
[(
"foo"
,
2
),
(
"bar"
,
3
)]
...
...
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