Skip to content

System.Numerics.Tensors Non-monotonic constructor errors #106538

@soerenwolfers

Description

@soerenwolfers

Description

new TensorSpan<double>(new double[j], lengths: new IntPtr[] {2}, strides: new IntPtr[] {1}); 

throws a ArgumentException if j == 1 but not if j == 0 or j > 1.

Reproduction Steps

using System.Diagnostics.CodeAnalysis;
using System.Numerics.Tensors;

namespace ConsoleApp1;

public abstract class Program
{
	[Experimental("SYSLIB5001")]
	public static void Main()
	{
		new TensorSpan<double>(new double[0], lengths: new IntPtr[] {2}, strides: new IntPtr[] {1});
		new TensorSpan<double>(new double[2], lengths: new IntPtr[] {2}, strides: new IntPtr[] {1});
		new TensorSpan<double>(new double[1], lengths: new IntPtr[] {2}, strides: new IntPtr[] {1}); 
	}
}

Expected behavior

Error when j <= 1

Actual behavior

Error if and only if j == 1

Regression?

No response

Known Workarounds

No response

Configuration

.NET8, Ubuntu22, x64

Other information

No response

Metadata

Metadata

Assignees

Labels

area-System.Numerics.Tensorsin-prThere is an active PR which will close this issue when it is merged

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions