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
3f29beb0
Commit
3f29beb0
authored
Feb 19, 2020
by
A. Unique TensorFlower
Browse files
Internal change
PiperOrigin-RevId: 296108291
parent
5cca172e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
7 deletions
+5
-7
official/utils/misc/keras_utils.py
official/utils/misc/keras_utils.py
+5
-7
No files found.
official/utils/misc/keras_utils.py
View file @
3f29beb0
...
@@ -26,7 +26,7 @@ from absl import logging
...
@@ -26,7 +26,7 @@ from absl import logging
import
tensorflow
as
tf
import
tensorflow
as
tf
from
tensorflow.core.protobuf
import
rewriter_config_pb2
from
tensorflow.core.protobuf
import
rewriter_config_pb2
from
tensorflow.python
import
tf2
from
tensorflow.python
import
tf2
from
tensorflow.python.
eag
er
import
profiler
from
tensorflow.python.
profil
er
import
profiler
_v2
as
profiler
class
BatchTimestamp
(
object
):
class
BatchTimestamp
(
object
):
...
@@ -145,17 +145,15 @@ class ProfilerCallback(tf.keras.callbacks.Callback):
...
@@ -145,17 +145,15 @@ class ProfilerCallback(tf.keras.callbacks.Callback):
def
on_batch_begin
(
self
,
batch
,
logs
=
None
):
def
on_batch_begin
(
self
,
batch
,
logs
=
None
):
if
batch
==
self
.
start_step_in_epoch
and
self
.
should_start
:
if
batch
==
self
.
start_step_in_epoch
and
self
.
should_start
:
self
.
should_start
=
False
self
.
should_start
=
False
profiler
.
start
()
profiler
.
start
(
self
.
log_dir
)
logging
.
info
(
'Profiler started at Step %s'
,
self
.
start_step
)
logging
.
info
(
'Profiler started at Step %s'
,
self
.
start_step
)
def
on_batch_end
(
self
,
batch
,
logs
=
None
):
def
on_batch_end
(
self
,
batch
,
logs
=
None
):
if
batch
==
self
.
stop_step_in_epoch
and
self
.
should_stop
:
if
batch
==
self
.
stop_step_in_epoch
and
self
.
should_stop
:
self
.
should_stop
=
False
self
.
should_stop
=
False
results
=
profiler
.
stop
()
profiler
.
stop
()
profiler
.
save
(
self
.
log_dir
,
results
)
logging
.
info
(
'Profiler saved profiles for steps between %s and %s to %s'
,
logging
.
info
(
self
.
start_step
,
self
.
stop_step
,
self
.
log_dir
)
'Profiler saved profiles for steps between %s and %s to %s'
,
self
.
start_step
,
self
.
stop_step
,
self
.
log_dir
)
def
set_session_config
(
enable_eager
=
False
,
def
set_session_config
(
enable_eager
=
False
,
...
...
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