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
e185b94c
Commit
e185b94c
authored
Feb 21, 2020
by
Hongkun Yu
Committed by
A. Unique TensorFlower
Feb 21, 2020
Browse files
Internal change
PiperOrigin-RevId: 296550109
parent
7b1553fd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
official/nlp/optimization.py
official/nlp/optimization.py
+8
-2
No files found.
official/nlp/optimization.py
View file @
e185b94c
...
...
@@ -137,10 +137,16 @@ class AdamWeightDecay(tf.keras.optimizers.Adam):
use_locking
=
self
.
_use_locking
)
return
tf
.
no_op
()
def
apply_gradients
(
self
,
grads_and_vars
,
name
=
None
):
def
apply_gradients
(
self
,
grads_and_vars
,
name
=
None
,
all_reduce_sum_gradients
=
True
):
grads
,
tvars
=
list
(
zip
(
*
grads_and_vars
))
(
grads
,
_
)
=
tf
.
clip_by_global_norm
(
grads
,
clip_norm
=
1.0
)
return
super
(
AdamWeightDecay
,
self
).
apply_gradients
(
zip
(
grads
,
tvars
))
return
super
(
AdamWeightDecay
,
self
).
apply_gradients
(
zip
(
grads
,
tvars
),
name
=
name
,
all_reduce_sum_gradients
=
all_reduce_sum_gradients
)
def
_get_lr
(
self
,
var_device
,
var_dtype
,
apply_state
):
"""Retrieves the learning rate with the given state."""
...
...
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