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
807296b3
Commit
807296b3
authored
Jul 18, 2016
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix locallyshuffledata
parent
3fcd3b57
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
7 deletions
+13
-7
tensorpack/dataflow/common.py
tensorpack/dataflow/common.py
+13
-7
No files found.
tensorpack/dataflow/common.py
View file @
807296b3
...
...
@@ -318,24 +318,30 @@ class LocallyShuffleData(ProxyDataFlow, RNGDataFlow):
def
reset_state
(
self
):
ProxyDataFlow
.
reset_state
(
self
)
RNGDataFlow
.
reset_state
(
self
)
self
.
ds_wrap
=
RepeatedData
(
self
.
ds
,
-
1
)
self
.
ds_itr
=
self
.
ds_wrap
.
get_data
()
self
.
ds_itr
=
self
.
ds
.
get_data
()
self
.
current_cnt
=
0
def
get_data
(
self
):
for
_
in
range
(
self
.
q
.
maxlen
-
len
(
self
.
q
)):
self
.
q
.
append
(
next
(
self
.
ds_itr
))
cnt
=
0
try
:
self
.
q
.
append
(
next
(
self
.
ds_itr
))
except
StopIteration
:
logger
.
error
(
"LocallyShuffleData: cache_size is larger than the size of ds!"
)
while
True
:
self
.
rng
.
shuffle
(
self
.
q
)
for
_
in
range
(
self
.
q
.
maxlen
):
yield
self
.
q
.
popleft
()
self
.
q
.
append
(
next
(
self
.
ds_itr
))
cnt
+=
1
if
cnt
==
self
.
size
():
try
:
self
.
q
.
append
(
next
(
self
.
ds_itr
))
except
StopIteration
:
# produce the rest and return
self
.
rng
.
shuffle
(
self
.
q
)
for
v
in
self
.
q
:
yield
v
return
def
SelectComponent
(
ds
,
idxs
):
"""
:param ds: a :mod:`DataFlow` instance
...
...
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