Language

IReadOnlyTensor<TSelf,T>.TryCopyTo(TensorSpan<T>) Method

Definition

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

public:
 bool TryCopyTo(System::Numerics::Tensors::TensorSpan<T> ^ destination);
public bool TryCopyTo(scoped in System.Numerics.Tensors.TensorSpan<T> destination);
abstract member TryCopyTo : TensorSpan -> bool
Public Function TryCopyTo (destination As TensorSpan(Of T)) As Boolean

Parameters

destination
TensorSpan<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 with equal element counts and identical views 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