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
e1b19c5d
You need to sign in or sign up before continuing.
Commit
e1b19c5d
authored
Dec 28, 2015
by
ppwwyyxx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add fakedata
parent
20becf84
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
2 deletions
+16
-2
dataflow/common.py
dataflow/common.py
+15
-2
utils/concurrency.py
utils/concurrency.py
+1
-0
No files found.
dataflow/common.py
View file @
e1b19c5d
#!/usr/bin/env python2
# -*- coding: UTF-8 -*-
# File:
batch
.py
# File:
common
.py
# Author: Yuxin Wu <ppwwyyxx@gmail.com>
import
numpy
as
np
from
.base
import
DataFlow
__all__
=
[
'BatchData'
,
'FixedSizeData'
]
__all__
=
[
'BatchData'
,
'FixedSizeData'
,
'FakeData'
]
class
BatchData
(
DataFlow
):
def
__init__
(
self
,
ds
,
batch_size
,
remainder
=
False
):
...
...
@@ -65,3 +65,16 @@ class FixedSizeData(DataFlow):
if
cnt
==
self
.
_size
:
return
class
FakeData
(
DataFlow
):
""" Build fake data of given shapes"""
def
__init__
(
self
,
shapes
,
size
):
self
.
shapes
=
shapes
self
.
_size
=
size
def
size
(
self
):
return
self
.
_size
def
get_data
(
self
):
for
_
in
xrange
(
self
.
_size
):
yield
tuple
((
np
.
random
.
random
(
k
)
for
k
in
self
.
shapes
))
utils/concurrency.py
View file @
e1b19c5d
...
...
@@ -44,6 +44,7 @@ class EnqueueThread(threading.Thread):
except
tf
.
errors
.
CancelledError
as
e
:
pass
except
Exception
:
# TODO close queue.
logger
.
exception
(
"Exception in EnqueueThread:"
)
self
.
coord
.
request_stop
()
...
...
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