Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
seminar-breakout
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Shashank Suhas
seminar-breakout
Commits
5467e48a
Commit
5467e48a
authored
Feb 09, 2018
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support more options on TFEventWriter (#645)
parent
54c5a42d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
4 deletions
+19
-4
tensorpack/callbacks/monitor.py
tensorpack/callbacks/monitor.py
+19
-4
No files found.
tensorpack/callbacks/monitor.py
View file @
5467e48a
...
...
@@ -196,15 +196,30 @@ class TFEventWriter(TrainingMonitor):
"""
Write summaries to TensorFlow event file.
"""
def
__new__
(
cls
):
if
logger
.
get_logger_dir
():
return
super
(
TFEventWriter
,
cls
)
.
__new__
(
cls
)
def
__init__
(
self
,
logdir
,
max_queue
=
10
,
flush_secs
=
120
):
"""
Args:
Same as in :class:`tf.summary.FileWriter`.
logdir will be ``logger.get_logger_dir()`` by default.
"""
self
.
_logdir
=
logdir
self
.
_max_queue
=
max_queue
self
.
_flush_secs
=
flush_secs
def
__new__
(
cls
,
logdir
=
None
,
max_queue
=
10
,
flush_secs
=
120
):
if
logdir
is
None
:
logdir
=
logger
.
get_logger_dir
()
if
logdir
is
not
None
:
return
super
(
TFEventWriter
,
cls
)
.
__new__
(
cls
,
logdir
,
max_queue
,
flush_secs
)
else
:
logger
.
warn
(
"logger directory was not set. Ignore TFEventWriter."
)
return
NoOpMonitor
()
def
_setup_graph
(
self
):
self
.
_writer
=
tf
.
summary
.
FileWriter
(
logger
.
get_logger_dir
(),
graph
=
tf
.
get_default_graph
())
self
.
_writer
=
tf
.
summary
.
FileWriter
(
self
.
_logdir
,
graph
=
tf
.
get_default_graph
(),
max_queue
=
self
.
_max_queue
,
flush_secs
=
self
.
_flush_secs
)
def
process_summary
(
self
,
summary
):
self
.
_writer
.
add_summary
(
summary
,
self
.
global_step
)
...
...
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