Jagamisviis:


TensorSpan<T> Constructors

Definition

Overloads

TensorSpan<T>(Array)

Creates a new TensorSpan<T> over the provided Array. The new TensorSpan<T> will have a rank of 1 and a length equal to the length of the provided Array.

TensorSpan<T>(T[], Int32, ReadOnlySpan<IntPtr>, ReadOnlySpan<IntPtr>)

Creates a new span over the portion of the target array beginning at 'start' index and ending at 'end' index (exclusive).

TensorSpan<T>(T*, IntPtr, ReadOnlySpan<IntPtr>, ReadOnlySpan<IntPtr>)

Creates a new span over the target unmanaged buffer. Clearly this is quite dangerous, because the length is not checked. But if this creation is correct, then all subsequent uses are correct.

TensorSpan<T>(Array, ReadOnlySpan<Int32>, ReadOnlySpan<IntPtr>, ReadOnlySpan<IntPtr>)

Creates a new TensorSpan<T> over the provided Array using the specified start offsets, lengths, and strides. If the strides are not provided, they will be automatically calculated.

TensorSpan<T>(Array, ReadOnlySpan<NIndex>, ReadOnlySpan<IntPtr>, ReadOnlySpan<IntPtr>)

Creates a new TensorSpan<T> over the provided Array using the specified start offsets, lengths, and strides. If the strides are not provided, they will be automatically calculated.

TensorSpan<T>(T[], Index, ReadOnlySpan<IntPtr>, ReadOnlySpan<IntPtr>)

Creates a new span over the portion of the target array beginning at 'start' index and ending at 'end' index (exclusive).

TensorSpan<T>(T*, IntPtr)

Creates a new span over the target unmanaged buffer. Clearly this is quite dangerous the length is not checked. But if this creation is correct, then all subsequent uses are correct.

TensorSpan<T>(T[])

Creates a new span over the entirety of the target array.

TensorSpan<T>(Span<T>)

Creates a new TensorSpan<T> over the provided Span<T>. The new TensorSpan<T> will have a rank of 1 and a length equal to the length of the provided Span<T>.

TensorSpan<T>(Span<T>, ReadOnlySpan<IntPtr>, ReadOnlySpan<IntPtr>)

Creates a new TensorSpan<T> over the provided Span<T> using the specified lengths and strides. If the strides are not provided, they will be automatically calculated.

TensorSpan<T>(Array)

Source:
TensorSpan.cs

Creates a new TensorSpan<T> over the provided Array. The new TensorSpan<T> will have a rank of 1 and a length equal to the length of the provided Array.

public:
 TensorSpan(Array ^ array);
public TensorSpan (Array? array);
new System.Numerics.Tensors.TensorSpan<'T> : Array -> System.Numerics.Tensors.TensorSpan<'T>
Public Sub New (array As Array)

Parameters

array
Array

The target array.

Applies to

TensorSpan<T>(T[], Int32, ReadOnlySpan<IntPtr>, ReadOnlySpan<IntPtr>)

Source:
TensorSpan.cs

Creates a new span over the portion of the target array beginning at 'start' index and ending at 'end' index (exclusive).

public:
 TensorSpan(cli::array <T> ^ array, int start, ReadOnlySpan<IntPtr> lengths, ReadOnlySpan<IntPtr> strides);
public TensorSpan (T[]? array, int start, scoped ReadOnlySpan<IntPtr> lengths, scoped ReadOnlySpan<IntPtr> strides);
new System.Numerics.Tensors.TensorSpan<'T> : 'T[] * int * ReadOnlySpan<nativeint> * ReadOnlySpan<nativeint> -> System.Numerics.Tensors.TensorSpan<'T>
Public Sub New (array As T(), start As Integer, lengths As ReadOnlySpan(Of IntPtr), strides As ReadOnlySpan(Of IntPtr))

Parameters

array
T[]

The target array.

start
Int32

The index at which to begin the span.

lengths

ReadOnlySpan<IntPtr>

ReadOnlySpan<nativeint>

The lengths of the dimensions. If default is provided its assumed to have 1 dimension with a length equal to the length of the data.

strides

ReadOnlySpan<IntPtr>

ReadOnlySpan<nativeint>

The strides of each dimension. If default or span of length 0 is provided then strides will be automatically calculated.

Exceptions

Thrown when array is covariant and array's type is not exactly T[].

Thrown when the specified start or end index is not in the range (<0 or >FlattenedLength).

Remarks

Returns default when array is null.

Applies to

TensorSpan<T>(T*, IntPtr, ReadOnlySpan<IntPtr>, ReadOnlySpan<IntPtr>)

Source:
TensorSpan.cs

Important

This API is not CLS-compliant.

Creates a new span over the target unmanaged buffer. Clearly this is quite dangerous, because the length is not checked. But if this creation is correct, then all subsequent uses are correct.

public:
 TensorSpan(T* data, IntPtr dataLength, ReadOnlySpan<IntPtr> lengths, ReadOnlySpan<IntPtr> strides);
[System.CLSCompliant(false)]
public TensorSpan (T* data, IntPtr dataLength, scoped ReadOnlySpan<IntPtr> lengths, scoped ReadOnlySpan<IntPtr> strides);
[<System.CLSCompliant(false)>]
new System.Numerics.Tensors.TensorSpan<'T> : nativeptr<'T> * nativeint * ReadOnlySpan<nativeint> * ReadOnlySpan<nativeint> -> System.Numerics.Tensors.TensorSpan<'T>

Parameters

data
T*

An unmanaged data to memory.

dataLength
IntPtr

nativeint

The number of elements the unmanaged memory can hold.

lengths

ReadOnlySpan<IntPtr>

ReadOnlySpan<nativeint>

The lengths of the dimensions. If default is provided its assumed to have 1 dimension with a length equal to the length of the data.

strides

ReadOnlySpan<IntPtr>

ReadOnlySpan<nativeint>

The lengths of the strides. If nothing is provided it figures out the default stride configuration.

Attributes

Exceptions

Thrown when T is reference type or contains pointers and hence cannot be stored in unmanaged memory.

Thrown when the specified length is negative.

Applies to

TensorSpan<T>(Array, ReadOnlySpan<Int32>, ReadOnlySpan<IntPtr>, ReadOnlySpan<IntPtr>)

Source:
TensorSpan.cs

Creates a new TensorSpan<T> over the provided Array using the specified start offsets, lengths, and strides. If the strides are not provided, they will be automatically calculated.

public:
 TensorSpan(Array ^ array, ReadOnlySpan<int> start, ReadOnlySpan<IntPtr> lengths, ReadOnlySpan<IntPtr> strides);
public TensorSpan (Array? array, scoped ReadOnlySpan<int> start, scoped ReadOnlySpan<IntPtr> lengths, scoped ReadOnlySpan<IntPtr> strides);
new System.Numerics.Tensors.TensorSpan<'T> : Array * ReadOnlySpan<int> * ReadOnlySpan<nativeint> * ReadOnlySpan<nativeint> -> System.Numerics.Tensors.TensorSpan<'T>
Public Sub New (array As Array, start As ReadOnlySpan(Of Integer), lengths As ReadOnlySpan(Of IntPtr), strides As ReadOnlySpan(Of IntPtr))

Parameters

array
Array

The target array.

start
ReadOnlySpan<Int32>

The starting offset for each dimension.

lengths

ReadOnlySpan<IntPtr>

ReadOnlySpan<nativeint>

The lengths of each dimension.

strides

ReadOnlySpan<IntPtr>

ReadOnlySpan<nativeint>

The strides for each dimension. Will be automatically calculated if not provided.

Applies to

TensorSpan<T>(Array, ReadOnlySpan<NIndex>, ReadOnlySpan<IntPtr>, ReadOnlySpan<IntPtr>)

Source:
TensorSpan.cs

Creates a new TensorSpan<T> over the provided Array using the specified start offsets, lengths, and strides. If the strides are not provided, they will be automatically calculated.

public:
 TensorSpan(Array ^ array, ReadOnlySpan<System::Buffers::NIndex> startIndex, ReadOnlySpan<IntPtr> lengths, ReadOnlySpan<IntPtr> strides);
public TensorSpan (Array? array, scoped ReadOnlySpan<System.Buffers.NIndex> startIndex, scoped ReadOnlySpan<IntPtr> lengths, scoped ReadOnlySpan<IntPtr> strides);
new System.Numerics.Tensors.TensorSpan<'T> : Array * ReadOnlySpan<System.Buffers.NIndex> * ReadOnlySpan<nativeint> * ReadOnlySpan<nativeint> -> System.Numerics.Tensors.TensorSpan<'T>
Public Sub New (array As Array, startIndex As ReadOnlySpan(Of NIndex), lengths As ReadOnlySpan(Of IntPtr), strides As ReadOnlySpan(Of IntPtr))

Parameters

array
Array

The target array.

startIndex
ReadOnlySpan<NIndex>

The starting offset for each dimension.

lengths

ReadOnlySpan<IntPtr>

ReadOnlySpan<nativeint>

The lengths of each dimension.

strides

ReadOnlySpan<IntPtr>

ReadOnlySpan<nativeint>

The strides for each dimension. Will be automatically calculated if not provided.

Applies to

TensorSpan<T>(T[], Index, ReadOnlySpan<IntPtr>, ReadOnlySpan<IntPtr>)

Source:
TensorSpan.cs

Creates a new span over the portion of the target array beginning at 'start' index and ending at 'end' index (exclusive).

public:
 TensorSpan(cli::array <T> ^ array, Index startIndex, ReadOnlySpan<IntPtr> lengths, ReadOnlySpan<IntPtr> strides);
public TensorSpan (T[]? array, Index startIndex, scoped ReadOnlySpan<IntPtr> lengths, scoped ReadOnlySpan<IntPtr> strides);
new System.Numerics.Tensors.TensorSpan<'T> : 'T[] * Index * ReadOnlySpan<nativeint> * ReadOnlySpan<nativeint> -> System.Numerics.Tensors.TensorSpan<'T>
Public Sub New (array As T(), startIndex As Index, lengths As ReadOnlySpan(Of IntPtr), strides As ReadOnlySpan(Of IntPtr))

Parameters

array
T[]

The target array.

startIndex
Index

The index at which to begin the span.

lengths

ReadOnlySpan<IntPtr>

ReadOnlySpan<nativeint>

The lengths of the dimensions. If default is provided its assumed to have 1 dimension with a length equal to the length of the data.

strides

ReadOnlySpan<IntPtr>

ReadOnlySpan<nativeint>

The strides of each dimension. If default or span of length 0 is provided then strides will be automatically calculated.

Exceptions

Thrown when array is covariant and array's type is not exactly T[].

Thrown when the specified startIndex or end index is not in the range (<0 or >FlattenedLength).

Remarks

Returns default when array is null.

Applies to

TensorSpan<T>(T*, IntPtr)

Source:
TensorSpan.cs

Important

This API is not CLS-compliant.

Creates a new span over the target unmanaged buffer. Clearly this is quite dangerous the length is not checked. But if this creation is correct, then all subsequent uses are correct.

public:
 TensorSpan(T* data, IntPtr dataLength);
[System.CLSCompliant(false)]
public TensorSpan (T* data, IntPtr dataLength);
[<System.CLSCompliant(false)>]
new System.Numerics.Tensors.TensorSpan<'T> : nativeptr<'T> * nativeint -> System.Numerics.Tensors.TensorSpan<'T>

Parameters

data
T*

An unmanaged data to memory.

dataLength
IntPtr

nativeint

The number of elements the unmanaged memory can hold.

Attributes

Remarks

Clearly this is quite dangerous the length is not checked. But if this creation is correct, then all subsequent uses are correct.

Applies to

TensorSpan<T>(T[])

Source:
TensorSpan.cs

Creates a new span over the entirety of the target array.

public:
 TensorSpan(cli::array <T> ^ array);
public TensorSpan (T[]? array);
new System.Numerics.Tensors.TensorSpan<'T> : 'T[] -> System.Numerics.Tensors.TensorSpan<'T>
Public Sub New (array As T())

Parameters

array
T[]

The target array.

Exceptions

Thrown when array is covariant and array's type is not exactly T[].

Remarks

Returns default when array is null.

Applies to

TensorSpan<T>(Span<T>)

Source:
TensorSpan.cs

Creates a new TensorSpan<T> over the provided Span<T>. The new TensorSpan<T> will have a rank of 1 and a length equal to the length of the provided Span<T>.

public:
 TensorSpan(Span<T> span);
public TensorSpan (Span<T> span);
new System.Numerics.Tensors.TensorSpan<'T> : Span<'T> -> System.Numerics.Tensors.TensorSpan<'T>
Public Sub New (span As Span(Of T))

Parameters

span
Span<T>

The target span.

Applies to

TensorSpan<T>(Span<T>, ReadOnlySpan<IntPtr>, ReadOnlySpan<IntPtr>)

Source:
TensorSpan.cs

Creates a new TensorSpan<T> over the provided Span<T> using the specified lengths and strides. If the strides are not provided, they will be automatically calculated.

public:
 TensorSpan(Span<T> span, ReadOnlySpan<IntPtr> lengths, ReadOnlySpan<IntPtr> strides);
public TensorSpan (Span<T> span, scoped ReadOnlySpan<IntPtr> lengths, scoped ReadOnlySpan<IntPtr> strides);
new System.Numerics.Tensors.TensorSpan<'T> : Span<'T> * ReadOnlySpan<nativeint> * ReadOnlySpan<nativeint> -> System.Numerics.Tensors.TensorSpan<'T>
Public Sub New (span As Span(Of T), lengths As ReadOnlySpan(Of IntPtr), strides As ReadOnlySpan(Of IntPtr))

Parameters

span
Span<T>

The target span.

lengths

ReadOnlySpan<IntPtr>

ReadOnlySpan<nativeint>

The lengths of each dimension.

strides

ReadOnlySpan<IntPtr>

ReadOnlySpan<nativeint>

The strides for each dimension. Will be automatically calculated if not provided.

Applies to