Share via


ReadOnlyTensorSpan<T> Constructors

Definition

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<IntPtr>

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<IntPtr>

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 and lengths or strides is not empty
  • start is not in range of array
  • lengths is not empty and contains an element that is either zero or negative
  • lengths is not empty and has a flattened length greater than array.Length
  • strides is not empty and has a length different from lengths
  • strides is not empty and contains an element that is negative
  • strides 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<IntPtr>

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<IntPtr>

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 is null and dataLength is not zero
  • data is null and lengths or strides is not empty
  • lengths is not empty and contains an element that is either zero or negative
  • lengths is not empty and has a flattened length greater than dataLength
  • strides is not empty and has a length different from lengths
  • strides is not empty and contains an element that is negative
  • strides 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<IntPtr>

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<IntPtr>

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 and lengths or strides is not empty
  • start is not in range of array
  • lengths is not empty and contains an element that is either zero or negative
  • lengths is not empty and has a flattened length greater than array.Length
  • strides is not empty and has a length different from lengths
  • strides is not empty and contains an element that is negative
  • strides 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<IntPtr>

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 is null and dataLength is not zero
  • data is null and lengths
  • lengths is not empty and contains an element that is either zero or negative
  • lengths is not empty and has a flattened length greater than dataLength

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<IntPtr>

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<IntPtr>

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 negative
  • lengths is not empty and has a flattened length greater than span.Length
  • strides is not empty and has a length different from lengths
  • strides is not empty and contains an element that is negative
  • strides 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<IntPtr>

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<IntPtr>

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 and lengths or strides is not empty
  • lengths is not empty and contains an element that is either zero or negative
  • lengths is not empty and has a flattened length greater than array.Length
  • strides is not empty and has a length different from lengths
  • strides is not empty and contains an element that is negative
  • strides 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<IntPtr>

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 negative
  • lengths is not empty and has a flattened length greater than span.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<IntPtr>

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 and lengths is not empty
  • lengths is not empty and contains an element that is either zero or negative
  • lengths is not empty and has a flattened length greater than array.Length

Remarks

Returns default when array is null.

Applies to