Avoid additional memory usage when performing hstack. #3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This PR optimizes memory usage during the
hstack
when stacking nodes saved in the CSC format. Previously, the output format was required to be in CSR format to ensure faster prediction times. However, this did not align withhstack
fast path cases (i.e., the input and output format should be consistent), leading to approximately 2 times the model size in additional memory. This was caused by the intermediate conversion:However, if the output format is required to be in CSC format, the above intermediate conversion becomes unnecessary. In this case, the
hstack
operation can directly convert nodes to a CSC sparse matrix.This PR addresses these inefficiencies and reduces the memory overhead by outputting a CSC sparse matrix during the stacking process.
Test CLI & API (
bash tests/autotest.sh
)Test APIs used by main.py.
Check API Document
If any new APIs are added, please check if the description of the APIs is added to API document.
Test quickstart & API (
bash tests/docs/test_changed_document.sh
)If any APIs in quickstarts or tutorials are modified, please run this test to check if the current examples can run correctly after the modified APIs are released.