ReadOnlyTensorSpan<T>.CastUp<TDerived> Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Casts a tensor span of TDerived
to a tensor span of T
.
public:
generic <typename TDerived>
where TDerived : class, T static System::Numerics::Tensors::ReadOnlyTensorSpan<T> CastUp(System::Numerics::Tensors::ReadOnlyTensorSpan<TDerived> % items);
public static System.Numerics.Tensors.ReadOnlyTensorSpan<T> CastUp<TDerived>(in System.Numerics.Tensors.ReadOnlyTensorSpan<TDerived> items) where TDerived : class, T;
static member CastUp : ReadOnlyTensorSpan -> System.Numerics.Tensors.ReadOnlyTensorSpan<'T>
Public Shared Function CastUp(Of TDerived As {Class, T}) (ByRef items As ReadOnlyTensorSpan(Of TDerived)) As ReadOnlyTensorSpan(Of T)
Type Parameters
- TDerived
The element type of the source tensor span, which must be derived from T
.
Parameters
- items
- ReadOnlyTensorSpan<TDerived>
The source tensor span. No copy is made.
Returns
A tensor span with elements cast to the new type.
Remarks
This method uses a covariant cast, producing a tensor span that shares the same memory as the source. The relationships expressed in the type constraints ensure that the cast is a safe operation.