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
c648e3ac
Commit
c648e3ac
authored
May 14, 2018
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into fpn
parents
b244fd0a
61bb05b5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
1 deletion
+19
-1
tensorpack/callbacks/steps.py
tensorpack/callbacks/steps.py
+19
-1
No files found.
tensorpack/callbacks/steps.py
View file @
c648e3ac
...
@@ -14,7 +14,7 @@ from ..tfutils.common import (
...
@@ -14,7 +14,7 @@ from ..tfutils.common import (
get_op_tensor_name
,
get_global_step_var
)
get_op_tensor_name
,
get_global_step_var
)
from
.base
import
Callback
from
.base
import
Callback
__all__
=
[
'TensorPrinter'
,
'ProgressBar'
]
__all__
=
[
'TensorPrinter'
,
'ProgressBar'
,
'SessionRunTimeout'
]
class
TensorPrinter
(
Callback
):
class
TensorPrinter
(
Callback
):
...
@@ -132,3 +132,21 @@ class MaintainStepCounter(Callback):
...
@@ -132,3 +132,21 @@ class MaintainStepCounter(Callback):
def
_after_run
(
self
,
_
,
__
):
def
_after_run
(
self
,
_
,
__
):
# Keep python-side global_step in agreement with TF-side
# Keep python-side global_step in agreement with TF-side
self
.
trainer
.
loop
.
_global_step
+=
1
self
.
trainer
.
loop
.
_global_step
+=
1
class
SessionRunTimeout
(
Callback
):
"""
Add timeout option to each sess.run call.
"""
def
__init__
(
self
,
timeout_in_ms
):
"""
Args:
timeout_in_ms (int):
"""
self
.
_timeout
=
int
(
timeout_in_ms
)
opt
=
tf
.
RunOptions
(
timeout_in_ms
=
timeout_in_ms
)
self
.
_runargs
=
tf
.
train
.
SessionRunArgs
(
fetches
=
[],
options
=
opt
)
def
_before_run
(
self
,
_
):
return
self
.
_runargs
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