-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
TensorPrimitives.IndexOfXx methods sometimes return the wrong index in the face of equality #97190
Comments
Tagging subscribers to this area: @dotnet/area-system-numerics Issue DetailsDescriptionWhen there are multiple equal elements that could have their index returned, the one with the smallest index is supposed to be returned. But it isn't always. Reproduction Stepsusing System.Numerics.Tensors;
ReadOnlySpan<float> floats = [10f, -20f, -30f, 1f, 1f, -40f];
Console.WriteLine(TensorPrimitives.IndexOfMinMagnitude(floats)); Expected behaviorThat should print Actual behaviorIt prints Regression?No Known WorkaroundsNo response ConfigurationSystem.Numerics.Tensors v8.0.0 nuget package Other informationNo response
|
I think the bug is here in the equality handling check: https://source.dot.net/#System.Numerics.Tensors/System/Numerics/Tensors/netcore/TensorPrimitives.netcore.cs,10125 We'll get down to the The We will then modify the The We will then modify the So the failure here looks to come about because What we have now is effectively:
What we need to say is:
This is required to ensure |
Description
When there are multiple equal elements that could have their index returned, the one with the smallest index is supposed to be returned. But it isn't always.
Reproduction Steps
or
Expected behavior
Those should both print
3
.Actual behavior
They print
4
.Regression?
No
Known Workarounds
No response
Configuration
System.Numerics.Tensors v8.0.0 nuget package
Other information
No response
The text was updated successfully, but these errors were encountered: