Skip to content

GH-49112: [C++] Support half-float tensors in equality comparison#49113

Open
HyukjinKwon wants to merge 1 commit intoapache:mainfrom
HyukjinKwon:GH-49112
Open

GH-49112: [C++] Support half-float tensors in equality comparison#49113
HyukjinKwon wants to merge 1 commit intoapache:mainfrom
HyukjinKwon:GH-49112

Conversation

@HyukjinKwon
Copy link
Member

@HyukjinKwon HyukjinKwon commented Feb 2, 2026

Rationale for this change

Half-float tensor equality comparison was not implemented. The TODO comment indicated this was missing functionality. Array/Scalar equality for half-float was already fixed in 72d20ad. This PR completes the support by adding tensor comparison.

What changes are included in this PR?

  • Add HALF_FLOAT case to TensorEquals() and sparse tensor comparison functions
  • Enable TestFloatTensor for HalfFloatType
  • Update static_assert to allow HalfFloatType in tensor comparison templates

Are these changes tested?

Yes, TestFloatTensor::Equals.

Are there any user-facing changes?

Yes, users can now compare half-float tensors using Tensor::Equals().

std::vector<int64_t> shape = {4, 4};

std::vector<c_data_type> c_values = {1, 2, 3, 4, 5, 6, 7, 8,
constexpr int c_vals_as_int_arr[] = {1, 2, 3, 4, 5, 6, 7, 8,
Copy link
Member Author

Choose a reason for hiding this comment

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

The variable name is a bit lengthty. Intentionally matched the line length to match with its previous length (so the next line doesn't need the diff). I can change the variable name :-).

@github-actions github-actions bot added awaiting committer review Awaiting committer review and removed awaiting review Awaiting review labels Feb 2, 2026
@HyukjinKwon HyukjinKwon force-pushed the GH-49112 branch 3 times, most recently from c88b7a2 to 5d1ab6a Compare February 3, 2026 01:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant