Tensor.Reshape 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
Reshape<T>(ReadOnlyTensorSpan<T>, ReadOnlySpan<IntPtr>) |
将 |
Reshape<T>(Tensor<T>, ReadOnlySpan<IntPtr>) |
将 |
Reshape<T>(TensorSpan<T>, ReadOnlySpan<IntPtr>) |
将 |
Reshape<T>(ReadOnlyTensorSpan<T>, ReadOnlySpan<IntPtr>)
- Source:
- TensorExtensions.cs
- Source:
- TensorExtensions.cs
将 tensor
张量重塑为指定的 lengths
。 如果其中一个长度为 -1,则会自动计算该长度。
不会更改基础内存的长度,也不会分配新内存。 如果新形状与旧形状不兼容,则会引发异常。
public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
static System::Numerics::Tensors::ReadOnlyTensorSpan<T> Reshape(System::Numerics::Tensors::ReadOnlyTensorSpan<T> % tensor, ReadOnlySpan<IntPtr> lengths);
public static System.Numerics.Tensors.ReadOnlyTensorSpan<T> Reshape<T> (this in System.Numerics.Tensors.ReadOnlyTensorSpan<T> tensor, scoped ReadOnlySpan<IntPtr> lengths);
static member Reshape : ReadOnlyTensorSpan * ReadOnlySpan<nativeint> -> System.Numerics.Tensors.ReadOnlyTensorSpan<'T>
<Extension()>
Public Function Reshape(Of T) (ByRef tensor As ReadOnlyTensorSpan(Of T), lengths As ReadOnlySpan(Of IntPtr)) As ReadOnlyTensorSpan(Of T)
类型参数
- T
参数
- tensor
- ReadOnlyTensorSpan<T>
TensorSpan<T> 你想要重塑。
- lengths
-
ReadOnlySpan<nativeint>
使用新维度 ReadOnlySpan<T>。
返回
适用于
Reshape<T>(Tensor<T>, ReadOnlySpan<IntPtr>)
- Source:
- TensorExtensions.cs
- Source:
- TensorExtensions.cs
将 tensor
张量重塑为指定的 lengths
。 如果其中一个长度为 -1,则会自动计算该长度。
不会更改基础内存的长度,也不会分配新内存。 如果新形状与旧形状不兼容,则会引发异常。
public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
static System::Numerics::Tensors::Tensor<T> ^ Reshape(System::Numerics::Tensors::Tensor<T> ^ tensor, ReadOnlySpan<IntPtr> lengths);
public static System.Numerics.Tensors.Tensor<T> Reshape<T> (this System.Numerics.Tensors.Tensor<T> tensor, scoped ReadOnlySpan<IntPtr> lengths);
static member Reshape : System.Numerics.Tensors.Tensor<'T> * ReadOnlySpan<nativeint> -> System.Numerics.Tensors.Tensor<'T>
<Extension()>
Public Function Reshape(Of T) (tensor As Tensor(Of T), lengths As ReadOnlySpan(Of IntPtr)) As Tensor(Of T)
类型参数
- T
参数
- lengths
-
ReadOnlySpan<nativeint>
使用新维度 ReadOnlySpan<T>。
返回
适用于
Reshape<T>(TensorSpan<T>, ReadOnlySpan<IntPtr>)
- Source:
- TensorExtensions.cs
- Source:
- TensorExtensions.cs
将 tensor
张量重塑为指定的 lengths
。 如果其中一个长度为 -1,则会自动计算该长度。
不会更改基础内存的长度,也不会分配新内存。 如果新形状与旧形状不兼容,则会引发异常。
public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
static System::Numerics::Tensors::TensorSpan<T> Reshape(System::Numerics::Tensors::TensorSpan<T> % tensor, ReadOnlySpan<IntPtr> lengths);
public static System.Numerics.Tensors.TensorSpan<T> Reshape<T> (this in System.Numerics.Tensors.TensorSpan<T> tensor, scoped ReadOnlySpan<IntPtr> lengths);
static member Reshape : TensorSpan * ReadOnlySpan<nativeint> -> System.Numerics.Tensors.TensorSpan<'T>
<Extension()>
Public Function Reshape(Of T) (ByRef tensor As TensorSpan(Of T), lengths As ReadOnlySpan(Of IntPtr)) As TensorSpan(Of T)
类型参数
- T
参数
- tensor
- TensorSpan<T>
TensorSpan<T> 你想要重塑。
- lengths
-
ReadOnlySpan<nativeint>
使用新维度 ReadOnlySpan<T>。