-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Open
Labels
area-System.Numerics.TensorsuntriagedNew issue has not been triaged by the area ownerNew issue has not been triaged by the area owner
Description
Given a non-dense ReadOnlyTensorSpan<T>, SequenceEqual will be false if the unobserved elements are not the same.
For example:
using System;
using System.Numerics.Tensors;
int[] d1 = [10, 20, 99, 99, 30, 40, 99, 99];
int[] d2 = [10, 20, 77, 77, 30, 40, 77, 77];
var ts1 = new ReadOnlyTensorSpan<int>(d1, [2, 2], [4, 1]);
var ts2 = new ReadOnlyTensorSpan<int>(d2, [2, 2], [4, 1]);
DumpTensorSpan(ts1);
DumpTensorSpan(ts2);
bool result = ts1.SequenceEqual(ts2);
Console.WriteLine($"SequenceEqual: {result}");
static void DumpTensorSpan<T>(ReadOnlyTensorSpan<T> span)
{
Console.WriteLine($"Dense: {span.IsDense}");
foreach (T x in span)
{
Console.Write($"{x}, ");
}
Console.WriteLine();
}This will print
Dense: False
10, 20, 30, 40,
Dense: False
10, 20, 30, 40,
SequenceEqual: False
I am not sure if this is "by design" or not. If it is, the documentation may want to make a note of how non-dense spans behavior.
The unit tests for this appear to be commented out:
| //public static void TensorSequenceEqualTests() |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-System.Numerics.TensorsuntriagedNew issue has not been triaged by the area ownerNew issue has not been triaged by the area owner