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
8f623281
Commit
8f623281
authored
Mar 13, 2019
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
warn about possibly-blocking initializer
parent
3862b72c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
3 deletions
+30
-3
tensorpack/tfutils/sesscreate.py
tensorpack/tfutils/sesscreate.py
+30
-3
No files found.
tensorpack/tfutils/sesscreate.py
View file @
8f623281
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
import
tensorflow
as
tf
import
tensorflow
as
tf
from
tensorflow.contrib.graph_editor
import
get_backward_walk_ops
from
..tfutils.common
import
tfv1
from
..tfutils.common
import
tfv1
from
..utils
import
logger
from
..utils
import
logger
...
@@ -42,9 +43,35 @@ bugs. See https://github.com/tensorpack/tensorpack/issues/497 for workarounds.")
...
@@ -42,9 +43,35 @@ bugs. See https://github.com/tensorpack/tensorpack/issues/497 for workarounds.")
def
create_session
(
self
):
def
create_session
(
self
):
sess
=
tf
.
Session
(
target
=
self
.
target
,
config
=
self
.
config
)
sess
=
tf
.
Session
(
target
=
self
.
target
,
config
=
self
.
config
)
sess
.
run
(
tf
.
global_variables_initializer
())
sess
.
run
(
tf
.
local_variables_initializer
())
def
blocking_op
(
op
):
sess
.
run
(
tf
.
tables_initializer
())
"""
Whether an op is possibly blocking.
"""
if
not
op
.
op_def
.
is_stateful
:
return
False
if
"Dequeue"
in
op
.
type
or
"Enqueue"
in
op
.
type
:
return
True
if
"Unstage"
in
op
.
type
:
return
True
if
op
.
type
in
[
"ZMQPull"
]:
return
True
return
False
def
run
(
op
):
deps
=
get_backward_walk_ops
(
op
,
control_inputs
=
True
)
for
dep_op
in
deps
:
if
dep_op
.
op_def
.
is_stateful
:
print
(
dep_op
.
type
)
if
blocking_op
(
dep_op
):
logger
.
warn
(
"Initializer '{}' depends on a blocking op '{}'. This initializer is likely to hang!"
.
format
(
op
.
name
,
dep_op
.
name
))
sess
.
run
(
op
)
run
(
tf
.
global_variables_initializer
())
run
(
tf
.
local_variables_initializer
())
run
(
tf
.
tables_initializer
())
return
sess
return
sess
...
...
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