Language

IReadOnlyTensor<TSelf,T>.TryFlattenTo(Span<T>) Method

Definition

Attempts to flatten the contents of this tensor into a destination span and returns a value to indicate whether or not the operation succeeded.

public:
 bool TryFlattenTo(Span<T> destination);
public bool TryFlattenTo(scoped Span<T> destination);
abstract member TryFlattenTo : Span<'T> -> bool
Public Function TryFlattenTo (destination As Span(Of T)) As Boolean

Parameters

destination
Span<T>

The target of the copy operation.

Returns

true if the copy operation succeeded; otherwise, false.

Exceptions

The source and destination overlap in an unsupported layout.

Remarks

Overlapping dense tensors are supported. Other overlapping layouts throw ArgumentException before copying.

If the destination length is shorter than the source, no items are copied and the method returns false.

Applies to