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
34dfab52
Commit
34dfab52
authored
Jun 07, 2017
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
don't assume default device in towercontext (#295)
parent
7c7957fc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
3 deletions
+2
-3
tensorpack/tfutils/tower.py
tensorpack/tfutils/tower.py
+2
-3
No files found.
tensorpack/tfutils/tower.py
View file @
34dfab52
...
@@ -29,8 +29,6 @@ class TowerContext(object):
...
@@ -29,8 +29,6 @@ class TowerContext(object):
'replicated' mode. Defaults to be tower_name.
'replicated' mode. Defaults to be tower_name.
"""
"""
self
.
_name
=
tower_name
self
.
_name
=
tower_name
if
device
is
None
:
device
=
'/gpu:0'
if
tf
.
test
.
is_gpu_available
()
else
'/cpu:0'
self
.
_device
=
device
self
.
_device
=
device
if
is_training
is
None
:
if
is_training
is
None
:
...
@@ -129,7 +127,8 @@ class TowerContext(object):
...
@@ -129,7 +127,8 @@ class TowerContext(object):
tf
.
get_variable_scope
(),
reuse
=
True
))
tf
.
get_variable_scope
(),
reuse
=
True
))
# if not training, should handle vs outside (TODO not good)
# if not training, should handle vs outside (TODO not good)
self
.
_ctxs
.
append
(
tf
.
name_scope
(
self
.
_name
))
self
.
_ctxs
.
append
(
tf
.
name_scope
(
self
.
_name
))
self
.
_ctxs
.
append
(
tf
.
device
(
self
.
_device
))
if
self
.
_device
is
not
None
:
self
.
_ctxs
.
append
(
tf
.
device
(
self
.
_device
))
for
c
in
self
.
_ctxs
:
for
c
in
self
.
_ctxs
:
c
.
__enter__
()
c
.
__enter__
()
...
...
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