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
f1b3f22c
Commit
f1b3f22c
authored
Aug 03, 2020
by
A. Unique TensorFlower
Browse files
Monitor the Keras' global batch size.
PiperOrigin-RevId: 324656070
parent
eab78118
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
0 deletions
+8
-0
official/utils/misc/keras_utils.py
official/utils/misc/keras_utils.py
+8
-0
No files found.
official/utils/misc/keras_utils.py
View file @
f1b3f22c
...
@@ -26,6 +26,12 @@ from absl import logging
...
@@ -26,6 +26,12 @@ from absl import logging
import
tensorflow
as
tf
import
tensorflow
as
tf
from
tensorflow.python.eager
import
monitoring
global_batch_size_gauge
=
monitoring
.
IntGauge
(
'/tensorflow/training/global_batch_size'
,
'TF training global batch size'
)
class
BatchTimestamp
(
object
):
class
BatchTimestamp
(
object
):
"""A structure to store batch time stamp."""
"""A structure to store batch time stamp."""
...
@@ -60,6 +66,8 @@ class TimeHistory(tf.keras.callbacks.Callback):
...
@@ -60,6 +66,8 @@ class TimeHistory(tf.keras.callbacks.Callback):
self
.
steps_in_epoch
=
0
self
.
steps_in_epoch
=
0
self
.
start_time
=
None
self
.
start_time
=
None
global_batch_size_gauge
.
get_cell
().
set
(
batch_size
)
if
logdir
:
if
logdir
:
self
.
summary_writer
=
tf
.
summary
.
create_file_writer
(
logdir
)
self
.
summary_writer
=
tf
.
summary
.
create_file_writer
(
logdir
)
else
:
else
:
...
...
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