Share via


Tensor.AsReadOnlyTensorSpan Method

Definition

Overloads

AsReadOnlyTensorSpan<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.

AsReadOnlyTensorSpan<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.

AsReadOnlyTensorSpan<T>(T[])

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

AsReadOnlyTensorSpan<T>(T[], ReadOnlySpan<IntPtr>)

Extension method to more easily create a TensorSpan from an array.

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

Source:
Tensor.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:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
 static System::Numerics::Tensors::ReadOnlyTensorSpan<T> AsReadOnlyTensorSpan(cli::array <T> ^ array, int start, ReadOnlySpan<IntPtr> lengths, ReadOnlySpan<IntPtr> strides);
public static System.Numerics.Tensors.ReadOnlyTensorSpan<T> AsReadOnlyTensorSpan<T>(this T[]? array, int start, scoped ReadOnlySpan<IntPtr> lengths, scoped ReadOnlySpan<IntPtr> strides);
static member AsReadOnlyTensorSpan : 'T[] * int * ReadOnlySpan<nativeint> * ReadOnlySpan<nativeint> -> System.Numerics.Tensors.ReadOnlyTensorSpan<'T>
<Extension()>
Public Function AsReadOnlyTensorSpan(Of T) (array As T(), start As Integer, lengths As ReadOnlySpan(Of IntPtr), strides As ReadOnlySpan(Of IntPtr)) As ReadOnlyTensorSpan(Of T)

Type Parameters

T

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.

Returns

Applies to

AsReadOnlyTensorSpan<T>(T[], ReadOnlySpan<IntPtr>, ReadOnlySpan<IntPtr>)

Source:
Tensor.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:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
 static System::Numerics::Tensors::ReadOnlyTensorSpan<T> AsReadOnlyTensorSpan(cli::array <T> ^ array, ReadOnlySpan<IntPtr> lengths, ReadOnlySpan<IntPtr> strides);
public static System.Numerics.Tensors.ReadOnlyTensorSpan<T> AsReadOnlyTensorSpan<T>(this T[]? array, scoped ReadOnlySpan<IntPtr> lengths, scoped ReadOnlySpan<IntPtr> strides);
static member AsReadOnlyTensorSpan : 'T[] * ReadOnlySpan<nativeint> * ReadOnlySpan<nativeint> -> System.Numerics.Tensors.ReadOnlyTensorSpan<'T>
<Extension()>
Public Function AsReadOnlyTensorSpan(Of T) (array As T(), lengths As ReadOnlySpan(Of IntPtr), strides As ReadOnlySpan(Of IntPtr)) As ReadOnlyTensorSpan(Of T)

Type Parameters

T

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.

Returns

Applies to

AsReadOnlyTensorSpan<T>(T[])

Source:
Tensor.cs

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

public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
 static System::Numerics::Tensors::ReadOnlyTensorSpan<T> AsReadOnlyTensorSpan(cli::array <T> ^ array);
public static System.Numerics.Tensors.ReadOnlyTensorSpan<T> AsReadOnlyTensorSpan<T>(this T[]? array);
static member AsReadOnlyTensorSpan : 'T[] -> System.Numerics.Tensors.ReadOnlyTensorSpan<'T>
<Extension()>
Public Function AsReadOnlyTensorSpan(Of T) (array As T()) As ReadOnlyTensorSpan(Of T)

Type Parameters

T

Parameters

array
T[]

The target array.

Returns

Applies to

AsReadOnlyTensorSpan<T>(T[], ReadOnlySpan<IntPtr>)

Source:
Tensor.cs
Source:
TensorExtensions.cs

Extension method to more easily create a TensorSpan from an array.

public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
 static System::Numerics::Tensors::ReadOnlyTensorSpan<T> AsReadOnlyTensorSpan(cli::array <T> ^ array, ReadOnlySpan<IntPtr> lengths);
public static System.Numerics.Tensors.ReadOnlyTensorSpan<T> AsReadOnlyTensorSpan<T>(this T[]? array, scoped ReadOnlySpan<IntPtr> lengths);
static member AsReadOnlyTensorSpan : 'T[] * ReadOnlySpan<nativeint> -> System.Numerics.Tensors.ReadOnlyTensorSpan<'T>
<Extension()>
Public Function AsReadOnlyTensorSpan(Of T) (array As T(), lengths As ReadOnlySpan(Of IntPtr)) As ReadOnlyTensorSpan(Of T)

Type Parameters

T

The type of the elements in the array

Parameters

array
T[]

The Array with the data

lengths

ReadOnlySpan<IntPtr>

ReadOnlySpan<nativeint>

The shape for the TensorSpan<T>

Returns

Applies to