-
Notifications
You must be signed in to change notification settings - Fork 3k
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
LabelEncoder kernel creation improvement #16516
LabelEncoder kernel creation improvement #16516
Conversation
Signed-off-by: Aditya Goel <[email protected]>
Closes #16575 |
@baijumeswani not sure if you are the right person to ask, but would it be possible to get a review on this? |
/azp run Linux CPU CI Pipeline, Linux CPU Minimal Build E2E CI Pipeline, Linux GPU CI Pipeline, Linux GPU TensorRT CI Pipeline, Linux OpenVINO CI Pipeline, MacOS CI Pipeline, ONNX Runtime Web CI Pipeline, onnxruntime-binary-size-checks-ci-pipeline, Linux QNN CI Pipeline |
/azp run Windows CPU CI Pipeline, Windows GPU CI Pipeline, Windows GPU TensorRT CI Pipeline, Windows ARM64 QNN CI Pipeline, orttraining-linux-ci-pipeline, orttraining-linux-gpu-ci-pipeline, orttraining-ortmodule-distributed, ONNX Runtime React Native CI Pipeline |
Azure Pipelines successfully started running 9 pipeline(s). |
Azure Pipelines successfully started running 8 pipeline(s). |
@baijumeswani looks like the CI has passed |
Thank you for your contribution. |
Description
This PR updates the initialisation of the
_map
inLabelEncoder_2
to be more memory efficient.std::unordered_map
toabsl::flat_hash_map
. The latter has a more compact layout and doesn't have the overhead of maintaining reference validity likestd::unordered_map
, which is a feature we do not need here since we only initialise_map
once at creation and then perform lookups duingcompute
. Abseil is already used extensively within onnxruntime.Motivation and Context
For very large lookups, the LabelEncoder's kernel creation can require more RAM than necessary. These simple changes in
_map
initialisation improve initialisation speed and memory allocated.