Skip to content

Commit 6abd7ef

Browse files
committed
Don't assert that dense spans aren't empty
1 parent 6c6d61d commit 6abd7ef

File tree

1 file changed

+5
-1
lines changed
  • src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore

1 file changed

+5
-1
lines changed

src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorShape.cs

+5-1
Original file line numberDiff line numberDiff line change
@@ -1101,7 +1101,11 @@ private void ValidateState()
11011101
{
11021102
if (IsDense)
11031103
{
1104-
Debug.Assert(!IsEmpty);
1104+
// We don't assert !IsEmpty as a zero lengthed slice that
1105+
// tracks a byref to physical memory will still be marked
1106+
// as dense. This is in contrast to the default empty span
1107+
// which is not.
1108+
11051109
Debug.Assert(FlattenedLength == LinearLength);
11061110
Debug.Assert(HasAnyDenseDimensions);
11071111
}

0 commit comments

Comments
 (0)