[python-package] do not copy column-major numpy arrays when predicting#6751
[python-package] do not copy column-major numpy arrays when predicting#6751
Conversation
StrikerRUS
left a comment
There was a problem hiding this comment.
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? |
jameslamb
left a comment
There was a problem hiding this comment.
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! |
|
This pull request has been automatically locked since there has not been any recent activity since it was closed. |
Follow up to #6721. This prevents copying the data array when predicting if it's column-major.