Tensor.Create 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.
Overloads
| Create<T>(T[]) |
Creates a new tensor over the entirety of the target array. |
| Create<T>(T[], ReadOnlySpan<IntPtr>) |
Creates a new tensor over the portion of the target array using the specified lengths. |
| Create<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. |
| Create<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. |
Create<T>(T[])
- Source:
- Tensor.cs
Creates a new tensor over the entirety of the target array.
public:
generic <typename T>
static System::Numerics::Tensors::Tensor<T> ^ Create(cli::array <T> ^ array);
public static System.Numerics.Tensors.Tensor<T> Create<T>(T[] array);
static member Create : 'T[] -> System.Numerics.Tensors.Tensor<'T>
Public Function Create(Of T) (array As T()) As Tensor(Of T)
Type Parameters
- T
Parameters
- array
- T[]
The target array.
Returns
A new tensor that uses array as its backing buffer.
Applies to
Create<T>(T[], ReadOnlySpan<IntPtr>)
- Source:
- Tensor.cs
Creates a new tensor over the portion of the target array using the specified lengths.
public:
generic <typename T>
static System::Numerics::Tensors::Tensor<T> ^ Create(cli::array <T> ^ array, ReadOnlySpan<IntPtr> lengths);
public static System.Numerics.Tensors.Tensor<T> Create<T>(T[] array, scoped ReadOnlySpan<IntPtr> lengths);
static member Create : 'T[] * ReadOnlySpan<nativeint> -> System.Numerics.Tensors.Tensor<'T>
Public Function Create(Of T) (array As T(), lengths As ReadOnlySpan(Of IntPtr)) As Tensor(Of T)
Type Parameters
- T
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.
Returns
A new tensor that uses array as its backing buffer and with the specified lengths.
Applies to
Create<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>
static System::Numerics::Tensors::Tensor<T> ^ Create(cli::array <T> ^ array, ReadOnlySpan<IntPtr> lengths, ReadOnlySpan<IntPtr> strides);
public static System.Numerics.Tensors.Tensor<T> Create<T>(T[] array, scoped ReadOnlySpan<IntPtr> lengths, scoped ReadOnlySpan<IntPtr> strides);
static member Create : 'T[] * ReadOnlySpan<nativeint> * ReadOnlySpan<nativeint> -> System.Numerics.Tensors.Tensor<'T>
Public Function Create(Of T) (array As T(), lengths As ReadOnlySpan(Of IntPtr), strides As ReadOnlySpan(Of IntPtr)) As Tensor(Of T)
Type Parameters
- T
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.
Returns
A new tensor that uses array as its backing buffer and with the specified lengths and strides.
Applies to
Create<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>
static System::Numerics::Tensors::Tensor<T> ^ Create(cli::array <T> ^ array, int start, ReadOnlySpan<IntPtr> lengths, ReadOnlySpan<IntPtr> strides);
public static System.Numerics.Tensors.Tensor<T> Create<T>(T[] array, int start, scoped ReadOnlySpan<IntPtr> lengths, scoped ReadOnlySpan<IntPtr> strides);
static member Create : 'T[] * int * ReadOnlySpan<nativeint> * ReadOnlySpan<nativeint> -> System.Numerics.Tensors.Tensor<'T>
Public Function Create(Of T) (array As T(), start As Integer, lengths As ReadOnlySpan(Of IntPtr), strides As ReadOnlySpan(Of IntPtr)) As Tensor(Of T)
Type Parameters
- T
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.
Returns
A new tensor that uses array as its backing buffer and with the specified lengths and strides.