Method broadcastToSame
static member broadcastToSame: Tensor<'TA> * Tensor<'TB> -> Tensor<'TA> * Tensor<'TB>
Broadcasts all specified tensors to have the same shape.
Declaration
static member broadcastToSame: a:Tensor<'TA> * b:Tensor<'TB> -> Tensor<'TA> * Tensor<'TB>
Parameters
Type | Name | Description |
---|---|---|
Tensor<'TA> | a | The tensor to operate on. |
Tensor<'TB> | b | The tensor to operate on. |
Returns
Type | Description |
---|---|
Tensor<'TA> * Tensor<'TB> | A tuple of the resulting tensors, all having the same shape. |
Type Parameters
Name | Description |
---|---|
'TA | |
'TB |
Remarks
First, size one dimensions are added from the left to each tensor until all of them have the same dimensionality. Then, size one dimensions are broadcasted to match the size of non-size-one dimensions.
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 [4L; 5L]
let b = HostTensor.zeros [3L; 4L; 5L]
let pa, pb = Tensor.broadcastToSame (a, b) // pa.Shape = [3L; 4L; 5L]; pb.Shape = [3L; 4L; 5L]
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Raised when broadcasting to a common shape is impossible. |
See Also
static member broadcastToSame: Tensor<'TA> * Tensor<'TB> * Tensor<'TC> -> Tensor<'TA> * Tensor<'TB> * Tensor<'TC>
Broadcasts all specified tensors to have the same shape.
Declaration
static member broadcastToSame: a:Tensor<'TA> * b:Tensor<'TB> * c:Tensor<'TC> -> Tensor<'TA> * Tensor<'TB> * Tensor<'TC>
Parameters
Type | Name | Description |
---|---|---|
Tensor<'TA> | a | The tensor to operate on. |
Tensor<'TB> | b | The tensor to operate on. |
Tensor<'TC> | c | The tensor to operate on. |
Returns
Type | Description |
---|---|
Tensor<'TA> * Tensor<'TB> * Tensor<'TC> | A tuple of the resulting tensors, all having the same shape. |
Type Parameters
Name | Description |
---|---|
'TA | |
'TB | |
'TC |
See Also
static member broadcastToSame: Tensor<'T> list -> Tensor<'T> list
Broadcasts all specified tensors to have the same shape.
Declaration
static member broadcastToSame: xs:Tensor<'T> list -> Tensor<'T> list
Parameters
Type | Name | Description |
---|---|---|
Tensor<'T> list | xs | A list of tensors to operate on. |
Returns
Type | Description |
---|---|
Tensor<'T> list | A list of the resulting tensors, all having the same shape. |