Skip to content

System.Numerics.Tensors Inconsistent TryFlattenTo & TryBroadcastTo vs TryCopyTo #106537

@soerenwolfers

Description

@soerenwolfers

Description

TryFlattenTo and TryBroadcastTo throw when destination is too short, TryCopyTo returns false.

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[1]).TryCopyTo(Array.Empty<double>());
		new TensorSpan<double>(new double[1]).TryFlattenTo(Array.Empty<double>());
	}
}

Expected behavior

Return false; never throw.

Actual behavior

ArgumentException

Regression?

No response

Known Workarounds

No response

Configuration

.Net8, Ubuntu22, x64

Other information

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions