-
Notifications
You must be signed in to change notification settings - Fork 6.1k
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
[rllib] More efficient tuple flattening. #4416
Conversation
Can one of the admins verify this patch? |
@@ -41,10 +42,14 @@ def transform(self, observation): | |||
"""Returns the preprocessed observation.""" | |||
raise NotImplementedError | |||
|
|||
def write(self, observation, array, offset): | |||
"""Alternative to transform for more efficient flattening.""" | |||
raise NotImplementedError |
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.
Should this have a default implementation that calls transform() and then puts it in the array? Otherwise I can see this exception coming up if you hit a preprocessor that doesn't support it (though it seems most preprocessors have write() implemented).
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.
Good suggestion, I'll add that.
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
@justinwyang any idea why Travis ran the Java tests and also the regular Python and Tune tests? This should PR should only have run
|
Test FAILed. |
Test PASSed. |
Test PASSed. |
Test FAILed. |
* More efficient tuple flattening. * Preprocessor.write uses transform by default. * lint * to array * Update test_catalog.py * Update test_catalog.py
What do these changes do?
I found tuple flattening to take up quite a lot of time (30% of total sampling), mainly due to creating lots of numpy arrays. This change creates only one array and then writes into it.
Related issue number