-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Refine data reader and move data_reader to async_data_reader. #726
Conversation
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.
Almost LGTM
class CriticalException(Exception): | ||
pass | ||
|
||
|
||
class SharedNDArray(object): |
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.
Please add some comments for this class
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.
fluid/DeepASR/data_utils/util.py
Outdated
self._is_verify = state[4] | ||
|
||
|
||
class SharedMemoryPoolManager(object): |
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.
Also please add some comments for this class.
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.
label_t.set(labels.ndarray, place) | ||
label_t.set_lod([lod.ndarray]) | ||
|
||
test_data_reader.recycle(features, labels, lod) |
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.
Can we hide the recycle, e.g. move it into the iterator?
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 have considered to hide this function, seems not trivial. We can validate the correctness first.
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.
AG
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.
Almost LGTM
fluid/DeepASR/data_utils/util.py
Outdated
self._buf = None | ||
self._array = np.zeros(1, dtype=np.float32) | ||
self._inited = False | ||
self._is_verify = is_verify |
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.
is_verify
--> to_verify
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.
fluid/DeepASR/data_utils/util.py
Outdated
class CriticalException(Exception): | ||
pass | ||
|
||
|
||
class SharedNDArray(object): | ||
"""SharedNDArray utilizes shared memory to avoid data serialization when | ||
object of which shared between different processes. We can reconstruct the |
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.
object of which
---> data object
between
--> among
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.
fluid/DeepASR/data_utils/util.py
Outdated
|
||
Args: | ||
name (str): Address name of shared memory. | ||
is_verify (bool): Whether to do validation for writing operation. |
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.
is_verify
--> to_verify
Whether to do validation for writing operation
--> Whether to validate the writing operation
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.
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.
LGTM
Resolves #705