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[], ReadOnlySpan<IntPtr>, ReadOnlySpan<IntPtr>, Boolean) |
Creates a Tensor<T> from the provided |
Create<T>(IEnumerable<T>, ReadOnlySpan<IntPtr>, ReadOnlySpan<IntPtr>, Boolean) |
Creates a Tensor<T> and initializes it with the data from |
Create<T>(T[], ReadOnlySpan<IntPtr>, Boolean) |
Creates a Tensor<T> from the provided |
Create<T>(ReadOnlySpan<IntPtr>, Boolean) |
Creates a Tensor<T> and initializes it with the default value of T. If |
Create<T>(IEnumerable<T>, ReadOnlySpan<IntPtr>, Boolean) |
Creates a Tensor<T> and initializes it with the data from |
Create<T>(ReadOnlySpan<IntPtr>, ReadOnlySpan<IntPtr>, Boolean) |
Creates a Tensor<T> and initializes it with the default value of T. If |
Create<T>(T[], ReadOnlySpan<IntPtr>, ReadOnlySpan<IntPtr>, Boolean)
- Source:
- Tensor.Factory.cs
Creates a Tensor<T> from the provided values
. If the product of the
lengths
does not equal the length of the values
array, an exception will be thrown.
public static System.Numerics.Tensors.Tensor<T> Create<T> (T[] values, scoped ReadOnlySpan<IntPtr> lengths, scoped ReadOnlySpan<IntPtr> strides, bool pinned = false);
static member Create : 'T[] * ReadOnlySpan<nativeint> * ReadOnlySpan<nativeint> * bool -> System.Numerics.Tensors.Tensor<'T>
Public Function Create(Of T) (values As T(), lengths As ReadOnlySpan(Of IntPtr), strides As ReadOnlySpan(Of IntPtr), Optional pinned As Boolean = false) As Tensor(Of T)
Type Parameters
- T
Parameters
- values
- T[]
An array of the backing memory.
- lengths
-
ReadOnlySpan<nativeint>
A ReadOnlySpan<T> indicating the lengths of each dimension.
- strides
-
ReadOnlySpan<nativeint>
A ReadOnlySpan<T> indicating the strides of each dimension.
Returns
Exceptions
Applies to
Create<T>(IEnumerable<T>, ReadOnlySpan<IntPtr>, ReadOnlySpan<IntPtr>, Boolean)
- Source:
- Tensor.Factory.cs
Creates a Tensor<T> and initializes it with the data from values
.
public static System.Numerics.Tensors.Tensor<T> Create<T> (System.Collections.Generic.IEnumerable<T> values, scoped ReadOnlySpan<IntPtr> lengths, scoped ReadOnlySpan<IntPtr> strides, bool pinned = false);
static member Create : seq<'T> * ReadOnlySpan<nativeint> * ReadOnlySpan<nativeint> * bool -> System.Numerics.Tensors.Tensor<'T>
Public Function Create(Of T) (values As IEnumerable(Of T), lengths As ReadOnlySpan(Of IntPtr), strides As ReadOnlySpan(Of IntPtr), Optional pinned As Boolean = false) As Tensor(Of T)
Type Parameters
- T
Parameters
- values
- IEnumerable<T>
A IEnumerable<T> with the data to use for the initialization.
- lengths
-
ReadOnlySpan<nativeint>
A ReadOnlySpan<T> indicating the lengths of each dimension.
- strides
-
ReadOnlySpan<nativeint>
A ReadOnlySpan<T> indicating the strides of each dimension.
Returns
Applies to
Create<T>(T[], ReadOnlySpan<IntPtr>, Boolean)
- Source:
- Tensor.Factory.cs
Creates a Tensor<T> from the provided values
. If the product of the
lengths
does not equal the length of the values
array, an exception will be thrown.
public static System.Numerics.Tensors.Tensor<T> Create<T> (T[] values, scoped ReadOnlySpan<IntPtr> lengths, bool pinned = false);
static member Create : 'T[] * ReadOnlySpan<nativeint> * bool -> System.Numerics.Tensors.Tensor<'T>
Public Function Create(Of T) (values As T(), lengths As ReadOnlySpan(Of IntPtr), Optional pinned As Boolean = false) As Tensor(Of T)
Type Parameters
- T
Parameters
- values
- T[]
An array of the backing memory.
- lengths
-
ReadOnlySpan<nativeint>
A ReadOnlySpan<T> indicating the lengths of each dimension.
Returns
Exceptions
Applies to
Create<T>(ReadOnlySpan<IntPtr>, Boolean)
- Source:
- Tensor.Factory.cs
Creates a Tensor<T> and initializes it with the default value of T. If pinned
is true, the memory will be pinned.
public static System.Numerics.Tensors.Tensor<T> Create<T> (scoped ReadOnlySpan<IntPtr> lengths, bool pinned = false);
static member Create : ReadOnlySpan<nativeint> * bool -> System.Numerics.Tensors.Tensor<'T>
Public Function Create(Of T) (lengths As ReadOnlySpan(Of IntPtr), Optional pinned As Boolean = false) As Tensor(Of T)
Type Parameters
- T
Parameters
- lengths
-
ReadOnlySpan<nativeint>
A ReadOnlySpan<T> indicating the lengths of each dimension.
Returns
Applies to
Create<T>(IEnumerable<T>, ReadOnlySpan<IntPtr>, Boolean)
- Source:
- Tensor.Factory.cs
Creates a Tensor<T> and initializes it with the data from values
.
public static System.Numerics.Tensors.Tensor<T> Create<T> (System.Collections.Generic.IEnumerable<T> values, scoped ReadOnlySpan<IntPtr> lengths, bool pinned = false);
static member Create : seq<'T> * ReadOnlySpan<nativeint> * bool -> System.Numerics.Tensors.Tensor<'T>
Public Function Create(Of T) (values As IEnumerable(Of T), lengths As ReadOnlySpan(Of IntPtr), Optional pinned As Boolean = false) As Tensor(Of T)
Type Parameters
- T
Parameters
- values
- IEnumerable<T>
A IEnumerable<T> with the data to use for the initialization.
- lengths
-
ReadOnlySpan<nativeint>
A ReadOnlySpan<T> indicating the lengths of each dimension.
Returns
Applies to
Create<T>(ReadOnlySpan<IntPtr>, ReadOnlySpan<IntPtr>, Boolean)
- Source:
- Tensor.Factory.cs
Creates a Tensor<T> and initializes it with the default value of T. If pinned
is true, the memory will be pinned.
public static System.Numerics.Tensors.Tensor<T> Create<T> (scoped ReadOnlySpan<IntPtr> lengths, scoped ReadOnlySpan<IntPtr> strides, bool pinned = false);
static member Create : ReadOnlySpan<nativeint> * ReadOnlySpan<nativeint> * bool -> System.Numerics.Tensors.Tensor<'T>
Public Function Create(Of T) (lengths As ReadOnlySpan(Of IntPtr), strides As ReadOnlySpan(Of IntPtr), Optional pinned As Boolean = false) As Tensor(Of T)
Type Parameters
- T
Parameters
- lengths
-
ReadOnlySpan<nativeint>
A ReadOnlySpan<T> indicating the lengths of each dimension.
- strides
-
ReadOnlySpan<nativeint>
A ReadOnlySpan<T> indicating the strides of each dimension.