Method tryReshapeView
static member tryReshapeView: int64 list -> Tensor<'T> -> Tensor<'T> option
Tries to create a reshaped view of the tensor (without copying).
Declaration
static member tryReshapeView: shp:int64 list -> a:Tensor<'T> -> Tensor<'T> option
Parameters
Type | Name | Description |
---|---|---|
int64 list | shp | The target shape. |
Tensor<'T> | a | The tensor to operate on. |
Returns
Type | Description |
---|---|
Tensor<'T> option | The reshaped tensor, if reshaping without copying is possible. Otherwise |
Remarks
Changes the shape of the tensor to the specified shape.
The total number of elements must not change.
One dimension of the shp
can be specified as val Remainder,
in which case the size of that dimension is inferred automatically.
If a reshape is not possible without copying the data of the tensor, None
is returned.
The operation returns a view of the original tensor and shares its storage. Modifications done to the returned tensor will affect the original tensor. Also, modifying the orignal tensor will affect the view.