Share via


Tensor.Reshape Method

Definition

Overloads

Reshape<T>(ReadOnlyTensorSpan<T>, ReadOnlySpan<IntPtr>)

Reshapes the tensor tensor to the specified lengths. If one of the lengths is -1, it will be calculated automatically. Does not change the length of the underlying memory nor does it allocate new memory. If the new shape is not compatible with the old shape, an exception is thrown.

Reshape<T>(Tensor<T>, ReadOnlySpan<IntPtr>)

Reshapes the tensor tensor to the specified lengths. If one of the lengths is -1, it will be calculated automatically. Does not change the length of the underlying memory nor does it allocate new memory. If the new shape is not compatible with the old shape, an exception is thrown.

Reshape<T>(TensorSpan<T>, ReadOnlySpan<IntPtr>)

Reshapes the tensor tensor to the specified lengths. If one of the lengths is -1, it will be calculated automatically. Does not change the length of the underlying memory nor does it allocate new memory. If the new shape is not compatible with the old shape, an exception is thrown.

Reshape<T>(ReadOnlyTensorSpan<T>, ReadOnlySpan<IntPtr>)

Source:
TensorExtensions.cs
Source:
TensorExtensions.cs

Reshapes the tensor tensor to the specified lengths. If one of the lengths is -1, it will be calculated automatically. Does not change the length of the underlying memory nor does it allocate new memory. If the new shape is not compatible with the old shape, an exception is thrown.

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)

Type Parameters

T

Parameters

tensor
ReadOnlyTensorSpan<T>

TensorSpan<T> you want to reshape.

lengths

ReadOnlySpan<IntPtr>

ReadOnlySpan<nativeint>

ReadOnlySpan<T> with the new dimensions.

Returns

Applies to

Reshape<T>(Tensor<T>, ReadOnlySpan<IntPtr>)

Source:
TensorExtensions.cs
Source:
TensorExtensions.cs

Reshapes the tensor tensor to the specified lengths. If one of the lengths is -1, it will be calculated automatically. Does not change the length of the underlying memory nor does it allocate new memory. If the new shape is not compatible with the old shape, an exception is thrown.

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)

Type Parameters

T

Parameters

tensor
Tensor<T>

Tensor<T> you want to reshape.

lengths

ReadOnlySpan<IntPtr>

ReadOnlySpan<nativeint>

ReadOnlySpan<T> with the new dimensions.

Returns

Applies to

Reshape<T>(TensorSpan<T>, ReadOnlySpan<IntPtr>)

Source:
TensorExtensions.cs
Source:
TensorExtensions.cs

Reshapes the tensor tensor to the specified lengths. If one of the lengths is -1, it will be calculated automatically. Does not change the length of the underlying memory nor does it allocate new memory. If the new shape is not compatible with the old shape, an exception is thrown.

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)

Type Parameters

T

Parameters

tensor
TensorSpan<T>

TensorSpan<T> you want to reshape.

lengths

ReadOnlySpan<IntPtr>

ReadOnlySpan<nativeint>

ReadOnlySpan<T> with the new dimensions.

Returns

Applies to