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
12856c3b
Commit
12856c3b
authored
Jul 28, 2021
by
A. Unique TensorFlower
Browse files
SpectralNormalization: Avoid errors in export by only applying update ops when training=True.
PiperOrigin-RevId: 387447417
parent
62487257
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
10 deletions
+13
-10
official/nlp/modeling/layers/spectral_normalization.py
official/nlp/modeling/layers/spectral_normalization.py
+13
-10
No files found.
official/nlp/modeling/layers/spectral_normalization.py
View file @
12856c3b
...
...
@@ -106,6 +106,7 @@ class SpectralNormalization(tf.keras.layers.Wrapper):
def
call
(
self
,
inputs
,
*
,
training
=
None
):
training
=
self
.
do_power_iteration
if
training
is
None
else
training
if
training
:
u_update_op
,
v_update_op
,
w_update_op
=
self
.
update_weights
(
training
=
training
)
output
=
self
.
layer
(
inputs
)
...
...
@@ -116,6 +117,8 @@ class SpectralNormalization(tf.keras.layers.Wrapper):
self
.
add_update
(
v_update_op
)
self
.
add_update
(
w_update_op
)
self
.
add_update
(
w_restore_op
)
else
:
output
=
self
.
layer
(
inputs
)
return
output
...
...
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