-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
[python-package] do not copy column-major numpy arrays when predicting #6751
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.
LGTM! Thanks for continuing working on this!
There is one more place where LightGBM/python-package/lightgbm/basic.py Lines 2358 to 2361 in 53be01f
But it'll require to change from single flag Could you please prepare one more PR for 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.
Thanks!
Merging this as-is because @StrikerRUS 's suggestion in #6751 (comment) is for a follow-up PR.
The create from mats function takes a single int argument for the layout LightGBM/include/LightGBM/c_api.h Lines 431 to 436 in 480600b
so they should all have the same layout. I can work on that, i.e. try not to copy if they all have the same layout and enforce row-major otherwise. |
Yeah, I saw this before writing my suggestion, and that's why I wrote:
I think that a small breaking change in public API worth it in exchange of saving memory. |
I see, I had misunderstood the suggestion. Sounds good, I'll work on that. |
@jmoralez Thanks a lot! |
Follow up to #6721. This prevents copying the data array when predicting if it's column-major.