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
9fff46d5
Commit
9fff46d5
authored
Oct 18, 2017
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove DataParallelFeedInput, as dataparallel inference now relies on QueueInput
parent
12cd6e6c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
59 deletions
+1
-59
tensorpack/input_source/input_source.py
tensorpack/input_source/input_source.py
+1
-59
No files found.
tensorpack/input_source/input_source.py
View file @
9fff46d5
...
...
@@ -23,7 +23,7 @@ from ..utils.develop import log_deprecated
from
..callbacks.base
import
Callback
from
..callbacks.graph
import
RunOp
__all__
=
[
'PlaceholderInput'
,
'FeedInput'
,
'DataParallelFeedInput'
,
__all__
=
[
'PlaceholderInput'
,
'FeedInput'
,
'FeedfreeInput'
,
'QueueInput'
,
'BatchQueueInput'
,
'DummyConstantInput'
,
'TensorInput'
,
...
...
@@ -99,64 +99,6 @@ class FeedInput(InputSource):
return
[
self
.
_cb
]
class
DataParallelFeedInput
(
FeedInput
):
"""
Input by feeding k datapoints to k copies of placeholders located on k towers.
"""
class
_DataParallelFeedCallback
(
Callback
):
def
__init__
(
self
,
ds
,
placeholders_per_tower
):
self
.
_ds
=
ds
self
.
_itr
=
self
.
_ds
.
get_data
()
self
.
_placehdrs_per_tower
=
placeholders_per_tower
self
.
_nr_tower
=
len
(
self
.
_placehdrs_per_tower
)
def
_reset
(
self
):
self
.
_ds
.
reset_state
()
self
.
_itr
=
self
.
_ds
.
get_data
()
def
_before_run
(
self
,
_
):
cnt
=
self
.
_nr_tower
feed
=
{}
for
t
in
range
(
cnt
):
dp
=
next
(
self
.
_itr
)
f
=
dict
(
zip
(
self
.
_placehdrs_per_tower
[
t
],
dp
))
feed
.
update
(
f
)
return
tf
.
train
.
SessionRunArgs
(
fetches
=
[],
feed_dict
=
feed
)
def
__init__
(
self
,
ds
,
tower_names
):
super
(
DataParallelFeedInput
,
self
)
.
__init__
(
ds
)
self
.
_tower_names
=
tower_names
self
.
_nr_tower
=
len
(
tower_names
)
def
_setup
(
self
,
inputs
):
self
.
_placehdrs_per_tower
=
[]
for
tname
in
self
.
_tower_names
:
# build a list of placeholders for each tower
self
.
_placehdrs_per_tower
.
append
(
[
v
.
build_placeholder
(
prefix
=
tname
+
'/'
)
for
v
in
inputs
])
self
.
_cb
=
self
.
_DataParallelFeedCallback
(
self
.
_iter_ds
,
self
.
_placehdrs_per_tower
)
def
_get_input_tensors
(
self
):
# return placeholders for each tower
ctx
=
get_current_tower_context
()
return
self
.
_placehdrs_per_tower
[
ctx
.
index
]
def
next_feed
(
self
,
cnt
=
1
):
"""
Args:
cnt: how many towers to feed to.
"""
cnt
=
int
(
cnt
)
assert
cnt
<
self
.
_nr_tower
feed
=
{}
for
t
in
range
(
cnt
):
dp
=
next
(
self
.
_cb
.
_itr
)
f
=
dict
(
zip
(
self
.
_placehdrs_per_tower
[
t
],
dp
))
feed
.
update
(
f
)
return
feed
class
FeedfreeInput
(
InputSource
):
""" Abstract base for input without feed,
e.g. by queue or other operations. """
...
...
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