Skip to content

Address latent bug in LabelEncoder#28496

Merged
yuslepukhin merged 2 commits into
mainfrom
yuslepukhin/fix_label_encoder_unpack_bug
May 14, 2026
Merged

Address latent bug in LabelEncoder#28496
yuslepukhin merged 2 commits into
mainfrom
yuslepukhin/fix_label_encoder_unpack_bug

Conversation

@yuslepukhin
Copy link
Copy Markdown
Member

This pull request refines how tensor attributes are unpacked in the CUDA LabelEncoder implementation. The main improvement is ensuring that the raw data from tensor protos is explicitly passed to the UnpackTensor utility, enhancing correctness and compatibility with various tensor data formats.

Tensor attribute unpacking improvements:

  • In both TryGetScalarTensorAttribute and GetAttrOrTensor functions in label_encoder.cc, the code now checks if the tensor proto contains raw data and, if so, passes the correct raw data pointer and length to utils::UnpackTensor. This replaces the previous approach of always passing nullptr and 0 for these parameters. [1] [2]

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR updates the CUDA LabelEncoder to correctly pass tensor proto raw-data buffers into utils::UnpackTensor, improving correctness for attributes stored in raw format.

Changes:

  • Passes raw_data pointer and length into utils::UnpackTensor when tensor protos contain raw data.
  • Applies the same unpacking fix in both scalar (TryGetScalarTensorAttribute) and vector (GetAttrOrTensor) attribute paths.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread onnxruntime/core/providers/cuda/ml/label_encoder.cc Outdated
Comment thread onnxruntime/core/providers/cuda/ml/label_encoder.cc Outdated
Comment thread onnxruntime/core/providers/cuda/ml/label_encoder.cc
@yuslepukhin yuslepukhin requested a review from tianleiwu May 13, 2026 22:06
@yuslepukhin yuslepukhin enabled auto-merge (squash) May 13, 2026 22:58
@yuslepukhin yuslepukhin merged commit 5f72956 into main May 14, 2026
88 checks passed
@yuslepukhin yuslepukhin deleted the yuslepukhin/fix_label_encoder_unpack_bug branch May 14, 2026 00:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants