Tensor.CreateFromShape 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
| 名称 | 说明 |
|---|---|
| CreateFromShape<T>(ReadOnlySpan<IntPtr>, ReadOnlySpan<IntPtr>, Boolean) |
创建具有指定长度和步幅的新张量。 |
| CreateFromShape<T>(ReadOnlySpan<IntPtr>, Boolean) |
创建具有指定长度的新张量。 |
CreateFromShape<T>(ReadOnlySpan<IntPtr>, ReadOnlySpan<IntPtr>, Boolean)
- Source:
- Tensor.cs
- Source:
- Tensor.cs
创建具有指定长度和步幅的新张量。
public static System.Numerics.Tensors.Tensor<T> CreateFromShape<T>(scoped ReadOnlySpan<IntPtr> lengths, scoped ReadOnlySpan<IntPtr> strides, bool pinned = false);
static member CreateFromShape : ReadOnlySpan<nativeint> * ReadOnlySpan<nativeint> * bool -> System.Numerics.Tensors.Tensor<'T>
Public Function CreateFromShape(Of T) (lengths As ReadOnlySpan(Of IntPtr), strides As ReadOnlySpan(Of IntPtr), Optional pinned As Boolean = false) As Tensor(Of T)
类型参数
- T
参数
- lengths
-
ReadOnlySpan<nativeint>
每个维度的长度。
- strides
-
ReadOnlySpan<nativeint>
每个维度的步幅。
- pinned
- Boolean
true 以固定基础缓冲区。 默认值为 false。
返回
具有指定 lengths 和 strides.
适用于
CreateFromShape<T>(ReadOnlySpan<IntPtr>, Boolean)
- Source:
- Tensor.cs
- Source:
- Tensor.cs
创建具有指定长度的新张量。
public static System.Numerics.Tensors.Tensor<T> CreateFromShape<T>(scoped ReadOnlySpan<IntPtr> lengths, bool pinned = false);
static member CreateFromShape : ReadOnlySpan<nativeint> * bool -> System.Numerics.Tensors.Tensor<'T>
Public Function CreateFromShape(Of T) (lengths As ReadOnlySpan(Of IntPtr), Optional pinned As Boolean = false) As Tensor(Of T)
类型参数
- T
参数
- lengths
-
ReadOnlySpan<nativeint>
每个维度的长度。
- pinned
- Boolean
true 以固定基础缓冲区。 默认值为 false。
返回
具有指定长度的新张量。