Method broadcastDim
static member broadcastDim: int -> int64 -> Tensor<'T> -> Tensor<'T>
Broadcast a dimension to a specified size.
Declaration
static member broadcastDim: dim:int -> size:int64 -> a:Tensor<'T> -> Tensor<'T>
Parameters
Type | Name | Description |
---|---|---|
int | dim | The size-one dimension to broadcast. |
int64 | size | The size to broadcast to. |
Tensor<'T> | a | The tensor to operate on. |
Returns
Type | Description |
---|---|
Tensor<'T> | The resulting tensor. |
Remarks
The broadcasted dimension must be of size one. The tensor is repeated size
times along
the axis dim
.
Broadcasting is usually performed automatically when the shapes allow for it. See broadcasting rules for details.
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 [3L; 1L; 5L]
let b = Tensor.broadCastDim 1 9L a // b.Shape = [3L; 9L; 5L]