Method broadcastTo
static member broadcastTo: int64 list -> Tensor<'T> -> Tensor<'T>
Broadcasts the specified tensor to the specified shape.
Declaration
static member broadcastTo: shp:int64 list -> a:Tensor<'T> -> Tensor<'T>
Parameters
Type | Name | Description |
---|---|---|
int64 list | shp | The target shape. |
Tensor<'T> | a | The tensor to operate on. |
Returns
Type | Description |
---|---|
Tensor<'T> | Tensor of shape |
Remarks
Size one dimensions are broadcasted to match the corresponding dimension of the target shape
shp
. Non-size-one dimensions must match the target shape.
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.
Examples
let a = HostTensor.zeros [1L; 7L; 1L]
let pa = Tensor.broadcastTo [2L; 7L; 3L] a // pa.Shape = [2L; 7L; 3L]
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Raised when broadcasting to the specified shape is impossible. |