ReadOnlyTensorSpan<T> Constructors
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.
Overloads
ReadOnlyTensorSpan<T>(Array) |
Creates a new tensor span over the entirety of the target array. |
ReadOnlyTensorSpan<T>(T[], Int32, ReadOnlySpan<IntPtr>, ReadOnlySpan<IntPtr>) |
Creates a new tensor over the portion of the target array beginning at the specified start index and using the specified lengths and strides. |
ReadOnlyTensorSpan<T>(T*, IntPtr, ReadOnlySpan<IntPtr>, ReadOnlySpan<IntPtr>) |
Creates a new tensor span over the target unmanaged buffer using the specified lengths and strides. |
ReadOnlyTensorSpan<T>(Array, ReadOnlySpan<Int32>, ReadOnlySpan<IntPtr>, ReadOnlySpan<IntPtr>) |
Creates a new tensor span over the portion of the target array beginning at the specified start index and using the specified lengths and strides. |
ReadOnlyTensorSpan<T>(T*, IntPtr, ReadOnlySpan<IntPtr>) |
Creates a new tensor span over the target unmanaged buffer using the specified lengths. |
ReadOnlyTensorSpan<T>(ReadOnlySpan<T>, ReadOnlySpan<IntPtr>, ReadOnlySpan<IntPtr>) |
Creates a new tensor span over the target span using the specified lengths and strides. |
ReadOnlyTensorSpan<T>(T[], ReadOnlySpan<IntPtr>, ReadOnlySpan<IntPtr>) |
Creates a new tensor over the portion of the target array beginning at the specified start index and using the specified lengths and strides. |
ReadOnlyTensorSpan<T>(T*, IntPtr) |
Creates a new tensor span over the target unmanaged buffer. |
ReadOnlyTensorSpan<T>(ReadOnlySpan<T>, ReadOnlySpan<IntPtr>) |
Creates a new tensor span over the target span using the specified lengths. |
ReadOnlyTensorSpan<T>(T[]) |
Creates a new tensor over the entirety of the target array. |
ReadOnlyTensorSpan<T>(ReadOnlySpan<T>) |
Creates a new tensor span over the entirety of the target span. |
ReadOnlyTensorSpan<T>(T[], ReadOnlySpan<IntPtr>) |
Creates a new tensor over the portion of the target array using the specified lengths. |
ReadOnlyTensorSpan<T>(Array)
- Source:
- ReadOnlyTensorSpan_1.cs
- Source:
- ReadOnlyTensorSpan.cs
Creates a new tensor span over the entirety of the target array.
public:
ReadOnlyTensorSpan(Array ^ array);
public ReadOnlyTensorSpan(Array? array);
new System.Numerics.Tensors.ReadOnlyTensorSpan<'T> : Array -> System.Numerics.Tensors.ReadOnlyTensorSpan<'T>
Public Sub New (array As Array)
Parameters
- array
- Array
The target array.
Remarks
Returns default when array
is null.
The created tensor span has a single dimension that is the same length as array
.
Applies to
ReadOnlyTensorSpan<T>(T[], Int32, ReadOnlySpan<IntPtr>, ReadOnlySpan<IntPtr>)
- Source:
- ReadOnlyTensorSpan_1.cs
- Source:
- ReadOnlyTensorSpan.cs
Creates a new tensor over the portion of the target array beginning at the specified start index and using the specified lengths and strides.
public:
ReadOnlyTensorSpan(cli::array <T> ^ array, int start, ReadOnlySpan<IntPtr> lengths, ReadOnlySpan<IntPtr> strides);
public ReadOnlyTensorSpan(T[]? array, int start, scoped ReadOnlySpan<IntPtr> lengths, scoped ReadOnlySpan<IntPtr> strides);
new System.Numerics.Tensors.ReadOnlyTensorSpan<'T> : 'T[] * int * ReadOnlySpan<nativeint> * ReadOnlySpan<nativeint> -> System.Numerics.Tensors.ReadOnlyTensorSpan<'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 tensor.
- lengths
-
ReadOnlySpan<nativeint>
The lengths of the dimensions. If an empty span is provided, the created tensor will have a single dimension that is the same length as array
.
- strides
-
ReadOnlySpan<nativeint>
The strides of each dimension. If an empty span is provided, then strides will be automatically calculated from lengths
.
Exceptions
array
is covariant and its type is not exactly T[].
Thrown when one of the following conditions is met:
array
is null andlengths
orstrides
is not emptystart
is not in range ofarray
lengths
is not empty and contains an element that is either zero or negativelengths
is not empty and has a flattened length greater thanarray
.Lengthstrides
is not empty and has a length different fromlengths
strides
is not empty and contains an element that is negativestrides
is not empty and contains an element that is zero in a non leading position
Remarks
Returns default when array
is null.
Applies to
ReadOnlyTensorSpan<T>(T*, IntPtr, ReadOnlySpan<IntPtr>, ReadOnlySpan<IntPtr>)
- Source:
- ReadOnlyTensorSpan_1.cs
- Source:
- ReadOnlyTensorSpan.cs
Important
This API is not CLS-compliant.
Creates a new tensor span over the target unmanaged buffer using the specified lengths and strides.
public:
ReadOnlyTensorSpan(T* data, IntPtr dataLength, ReadOnlySpan<IntPtr> lengths, ReadOnlySpan<IntPtr> strides);
[System.CLSCompliant(false)]
public ReadOnlyTensorSpan(T* data, IntPtr dataLength, scoped ReadOnlySpan<IntPtr> lengths, scoped ReadOnlySpan<IntPtr> strides);
[<System.CLSCompliant(false)>]
new System.Numerics.Tensors.ReadOnlyTensorSpan<'T> : nativeptr<'T> * nativeint * ReadOnlySpan<nativeint> * ReadOnlySpan<nativeint> -> System.Numerics.Tensors.ReadOnlyTensorSpan<'T>
Parameters
- data
- T*
The pointer to the start of the target unmanaged buffer.
- dataLength
-
IntPtr
nativeint
The number of elements the target unmanaged buffer contains.
- lengths
-
ReadOnlySpan<nativeint>
The lengths of the dimensions. If an empty span is provided, the created tensor span will have a single dimension that is the same length as dataLength
.
- strides
-
ReadOnlySpan<nativeint>
The strides of each dimension. If an empty span is provided, then strides will be automatically calculated from lengths
.
- Attributes
Exceptions
T
is a reference type or contains pointers and hence cannot be stored in unmanaged memory.
Thrown when one of the following conditions is met:
data
isnull
anddataLength
is not zerodata
is null andlengths
orstrides
is not emptylengths
is not empty and contains an element that is either zero or negativelengths
is not empty and has a flattened length greater thandataLength
strides
is not empty and has a length different fromlengths
strides
is not empty and contains an element that is negativestrides
is not empty and contains an element that is zero in a non leading position
Remarks
Returns default when data
is null.
Applies to
ReadOnlyTensorSpan<T>(Array, ReadOnlySpan<Int32>, ReadOnlySpan<IntPtr>, ReadOnlySpan<IntPtr>)
- Source:
- ReadOnlyTensorSpan_1.cs
- Source:
- ReadOnlyTensorSpan.cs
Creates a new tensor span over the portion of the target array beginning at the specified start index and using the specified lengths and strides.
public:
ReadOnlyTensorSpan(Array ^ array, ReadOnlySpan<int> start, ReadOnlySpan<IntPtr> lengths, ReadOnlySpan<IntPtr> strides);
public ReadOnlyTensorSpan(Array? array, scoped ReadOnlySpan<int> start, scoped ReadOnlySpan<IntPtr> lengths, scoped ReadOnlySpan<IntPtr> strides);
new System.Numerics.Tensors.ReadOnlyTensorSpan<'T> : Array * ReadOnlySpan<int> * ReadOnlySpan<nativeint> * ReadOnlySpan<nativeint> -> System.Numerics.Tensors.ReadOnlyTensorSpan<'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 index at which to begin the tensor span.
- lengths
-
ReadOnlySpan<nativeint>
The lengths of the dimensions. If an empty span is provided, the created tensor span will have a single dimension that is the same length as array
.
- strides
-
ReadOnlySpan<nativeint>
The strides of each dimension. If an empty span is provided, then strides will be automatically calculated from lengths
.
Exceptions
Thrown when one of the following conditions is met:
array
is null andlengths
orstrides
is not emptystart
is not in range ofarray
lengths
is not empty and contains an element that is either zero or negativelengths
is not empty and has a flattened length greater thanarray
.Lengthstrides
is not empty and has a length different fromlengths
strides
is not empty and contains an element that is negativestrides
is not empty and contains an element that is zero in a non leading position
Remarks
Returns default when array
is null.
Applies to
ReadOnlyTensorSpan<T>(T*, IntPtr, ReadOnlySpan<IntPtr>)
- Source:
- ReadOnlyTensorSpan_1.cs
Important
This API is not CLS-compliant.
Creates a new tensor span over the target unmanaged buffer using the specified lengths.
public:
ReadOnlyTensorSpan(T* data, IntPtr dataLength, ReadOnlySpan<IntPtr> lengths);
[System.CLSCompliant(false)]
public ReadOnlyTensorSpan(T* data, IntPtr dataLength, scoped ReadOnlySpan<IntPtr> lengths);
[<System.CLSCompliant(false)>]
new System.Numerics.Tensors.ReadOnlyTensorSpan<'T> : nativeptr<'T> * nativeint * ReadOnlySpan<nativeint> -> System.Numerics.Tensors.ReadOnlyTensorSpan<'T>
Parameters
- data
- T*
The pointer to the start of the target unmanaged buffer.
- dataLength
-
IntPtr
nativeint
The number of elements the target unmanaged buffer contains.
- lengths
-
ReadOnlySpan<nativeint>
The lengths of the dimensions. If an empty span is provided, the created tensor span will have a single dimension that is the same length as dataLength
.
- Attributes
Exceptions
Thrown when one of the following conditions is met:
data
isnull
anddataLength
is not zerodata
is null andlengths
lengths
is not empty and contains an element that is either zero or negativelengths
is not empty and has a flattened length greater thandataLength
Remarks
Returns default when data
is null.
Applies to
ReadOnlyTensorSpan<T>(ReadOnlySpan<T>, ReadOnlySpan<IntPtr>, ReadOnlySpan<IntPtr>)
- Source:
- ReadOnlyTensorSpan_1.cs
- Source:
- ReadOnlyTensorSpan.cs
Creates a new tensor span over the target span using the specified lengths and strides.
public:
ReadOnlyTensorSpan(ReadOnlySpan<T> span, ReadOnlySpan<IntPtr> lengths, ReadOnlySpan<IntPtr> strides);
public ReadOnlyTensorSpan(ReadOnlySpan<T> span, scoped ReadOnlySpan<IntPtr> lengths, scoped ReadOnlySpan<IntPtr> strides);
new System.Numerics.Tensors.ReadOnlyTensorSpan<'T> : ReadOnlySpan<'T> * ReadOnlySpan<nativeint> * ReadOnlySpan<nativeint> -> System.Numerics.Tensors.ReadOnlyTensorSpan<'T>
Public Sub New (span As ReadOnlySpan(Of T), lengths As ReadOnlySpan(Of IntPtr), strides As ReadOnlySpan(Of IntPtr))
Parameters
- span
- ReadOnlySpan<T>
The target span.
- lengths
-
ReadOnlySpan<nativeint>
The lengths of the dimensions. If an empty span is provided, the created tensor span will have a single dimension that is the same length as span
.
- strides
-
ReadOnlySpan<nativeint>
The strides of each dimension. If an empty span is provided, then strides will be automatically calculated from lengths
.
Exceptions
Thrown when one of the following conditions is met:
lengths
is not empty and contains an element that is either zero or negativelengths
is not empty and has a flattened length greater thanspan
.Lengthstrides
is not empty and has a length different fromlengths
strides
is not empty and contains an element that is negativestrides
is not empty and contains an element that is zero in a non leading position
Applies to
ReadOnlyTensorSpan<T>(T[], ReadOnlySpan<IntPtr>, ReadOnlySpan<IntPtr>)
- Source:
- ReadOnlyTensorSpan_1.cs
Creates a new tensor over the portion of the target array beginning at the specified start index and using the specified lengths and strides.
public:
ReadOnlyTensorSpan(cli::array <T> ^ array, ReadOnlySpan<IntPtr> lengths, ReadOnlySpan<IntPtr> strides);
public ReadOnlyTensorSpan(T[]? array, scoped ReadOnlySpan<IntPtr> lengths, scoped ReadOnlySpan<IntPtr> strides);
new System.Numerics.Tensors.ReadOnlyTensorSpan<'T> : 'T[] * ReadOnlySpan<nativeint> * ReadOnlySpan<nativeint> -> System.Numerics.Tensors.ReadOnlyTensorSpan<'T>
Public Sub New (array As T(), lengths As ReadOnlySpan(Of IntPtr), strides As ReadOnlySpan(Of IntPtr))
Parameters
- array
- T[]
The target array.
- lengths
-
ReadOnlySpan<nativeint>
The lengths of the dimensions. If an empty span is provided, the created tensor will have a single dimension that is the same length as array
.
- strides
-
ReadOnlySpan<nativeint>
The strides of each dimension. If an empty span is provided, then strides will be automatically calculated from lengths
.
Exceptions
Thrown when one of the following conditions is met:
array
is null andlengths
orstrides
is not emptylengths
is not empty and contains an element that is either zero or negativelengths
is not empty and has a flattened length greater thanarray
.Lengthstrides
is not empty and has a length different fromlengths
strides
is not empty and contains an element that is negativestrides
is not empty and contains an element that is zero in a non leading position
Remarks
Returns default when array
is null.
Applies to
ReadOnlyTensorSpan<T>(T*, IntPtr)
- Source:
- ReadOnlyTensorSpan_1.cs
- Source:
- ReadOnlyTensorSpan.cs
Important
This API is not CLS-compliant.
Creates a new tensor span over the target unmanaged buffer.
public:
ReadOnlyTensorSpan(T* data, IntPtr dataLength);
[System.CLSCompliant(false)]
public ReadOnlyTensorSpan(T* data, IntPtr dataLength);
[<System.CLSCompliant(false)>]
new System.Numerics.Tensors.ReadOnlyTensorSpan<'T> : nativeptr<'T> * nativeint -> System.Numerics.Tensors.ReadOnlyTensorSpan<'T>
Parameters
- data
- T*
The pointer to the start of the target unmanaged buffer.
- dataLength
-
IntPtr
nativeint
The number of elements the target unmanaged buffer contains.
- Attributes
Exceptions
data
is null
and dataLength
is not zero
Remarks
Returns default when data
is null.
Applies to
ReadOnlyTensorSpan<T>(ReadOnlySpan<T>, ReadOnlySpan<IntPtr>)
- Source:
- ReadOnlyTensorSpan_1.cs
Creates a new tensor span over the target span using the specified lengths.
public:
ReadOnlyTensorSpan(ReadOnlySpan<T> span, ReadOnlySpan<IntPtr> lengths);
public ReadOnlyTensorSpan(ReadOnlySpan<T> span, scoped ReadOnlySpan<IntPtr> lengths);
new System.Numerics.Tensors.ReadOnlyTensorSpan<'T> : ReadOnlySpan<'T> * ReadOnlySpan<nativeint> -> System.Numerics.Tensors.ReadOnlyTensorSpan<'T>
Public Sub New (span As ReadOnlySpan(Of T), lengths As ReadOnlySpan(Of IntPtr))
Parameters
- span
- ReadOnlySpan<T>
The target span.
- lengths
-
ReadOnlySpan<nativeint>
The lengths of the dimensions. If an empty span is provided, the created tensor span will have a single dimension that is the same length as span
.
Exceptions
Thrown when one of the following conditions is met:
lengths
is not empty and contains an element that is either zero or negativelengths
is not empty and has a flattened length greater thanspan
.Length
Applies to
ReadOnlyTensorSpan<T>(T[])
- Source:
- ReadOnlyTensorSpan_1.cs
- Source:
- ReadOnlyTensorSpan.cs
Creates a new tensor over the entirety of the target array.
public:
ReadOnlyTensorSpan(cli::array <T> ^ array);
public ReadOnlyTensorSpan(T[]? array);
new System.Numerics.Tensors.ReadOnlyTensorSpan<'T> : 'T[] -> System.Numerics.Tensors.ReadOnlyTensorSpan<'T>
Public Sub New (array As T())
Parameters
- array
- T[]
The target array.
Exceptions
array
is covariant and its type is not exactly T[].
Remarks
Returns default when array
is null.
The created tensor span has a single dimension that is the same length as array
.
Applies to
ReadOnlyTensorSpan<T>(ReadOnlySpan<T>)
- Source:
- ReadOnlyTensorSpan_1.cs
- Source:
- ReadOnlyTensorSpan.cs
Creates a new tensor span over the entirety of the target span.
public:
ReadOnlyTensorSpan(ReadOnlySpan<T> span);
public ReadOnlyTensorSpan(ReadOnlySpan<T> span);
new System.Numerics.Tensors.ReadOnlyTensorSpan<'T> : ReadOnlySpan<'T> -> System.Numerics.Tensors.ReadOnlyTensorSpan<'T>
Public Sub New (span As ReadOnlySpan(Of T))
Parameters
- span
- ReadOnlySpan<T>
The target span.
Remarks
The created tensor span has a single dimension that is the same length as span
.
Applies to
ReadOnlyTensorSpan<T>(T[], ReadOnlySpan<IntPtr>)
- Source:
- ReadOnlyTensorSpan_1.cs
Creates a new tensor over the portion of the target array using the specified lengths.
public:
ReadOnlyTensorSpan(cli::array <T> ^ array, ReadOnlySpan<IntPtr> lengths);
public ReadOnlyTensorSpan(T[]? array, scoped ReadOnlySpan<IntPtr> lengths);
new System.Numerics.Tensors.ReadOnlyTensorSpan<'T> : 'T[] * ReadOnlySpan<nativeint> -> System.Numerics.Tensors.ReadOnlyTensorSpan<'T>
Public Sub New (array As T(), lengths As ReadOnlySpan(Of IntPtr))
Parameters
- array
- T[]
The target array.
- lengths
-
ReadOnlySpan<nativeint>
The lengths of the dimensions. If an empty span is provided, the created tensor will have a single dimension that is the same length as array
.
Exceptions
Thrown when one of the following conditions is met:
array
is null andlengths
is not emptylengths
is not empty and contains an element that is either zero or negativelengths
is not empty and has a flattened length greater thanarray
.Length
Remarks
Returns default when array
is null.