-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use terminology *data reader creator* instead of *data reader*, and r… #1412
Conversation
…emove lambda usage from design doc
doc/design/reader/README.md
Outdated
def data_reader_bool(t): | ||
while True: | ||
yield t | ||
def data_reader_creator_bool(t): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data_reader_bool ==> reader_creator_bool
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
doc/design/reader/README.md
Outdated
while True: | ||
yield t | ||
def data_reader_creator_bool(t): | ||
def creator: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
creator ==> reader
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
doc/design/reader/README.md
Outdated
|
||
For example, we want to use a source of real images (reusing mnist dataset), and a source of fake images as input for [Generative Adversarial Networks](https://arxiv.org/abs/1406.2661). | ||
|
||
We can do: | ||
|
||
```python | ||
def data_reader_fake_image(): | ||
def data_reader_creator_fake_image(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data_reader_creator_fake_image ==> reader_creator_random_image
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
doc/design/reader/README.md
Outdated
|
||
For example, we want to use a source of real images (reusing mnist dataset), and a source of fake images as input for [Generative Adversarial Networks](https://arxiv.org/abs/1406.2661). | ||
|
||
We can do: | ||
|
||
```python | ||
def data_reader_fake_image(): | ||
def data_reader_creator_fake_image(): | ||
while True: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reader_creator_random_image 应该有参数表示图像大小
def reader_creator_random_image(width, height):
def reader():
while True:
yield numpy.random.uniform(-1, 1, size=width*height)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
doc/design/reader/README.md
Outdated
|
||
Paddle reads data from data reader during training. It will be passed into `paddle.train` as a parameter. | ||
Paddle reads data from *data reader* during training. *data reader creator* (or *reader creator*) creates a *data reader* when invoked. *reader creator* will be passed into `paddle.train` as a parameter. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At training and testing time, PaddlePaddle programs need to read data. To ease the users' work to write data readign code, we define that
- A reader is a function that reads data (from file, network, random number generator, etc) and yields data items.
- A reader creator is a function that returns a reader function.
- A reader decorator is a function, which accepts one or more readers, and returns a reader.
and provide frequently used reader creators and reader decorators.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
doc/design/reader/README.md
Outdated
|
||
Data reader is a function with no parameter that creates a iterable (anything can be used in `for x in iterable`): | ||
Data reader creator is a function with no parameter that creates a iterable (anything can be used in `for x in iterable`): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a reader creator can have parameters. For example:
def reader_creator_text(filename):
def reader():
... read from filename ...
return reader
Here the creator does have one paraemter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
doc/design/reader/README.md
Outdated
@@ -41,11 +41,11 @@ label_layer = paddle.layer.data("label", ...) | |||
paddle.train(paddle.dataset.mnist, {"image":0, "label":1}, 128, 10, ...) | |||
``` | |||
|
|||
## Data Reader Decorators | |||
## Data Reader Creator Decorator |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reader Creator Decorator ==> Reader Decorator
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
…emove lambda usage from design doc