Method ofBlocks
static member ofBlocks: BlockTensor<'T> -> Tensor<'T>
Builds a tensor out of tensor blocks.
Declaration
static member ofBlocks: bs:BlockTensor<'T> -> Tensor<'T>
Parameters
| Type | Name | Description |
|---|---|---|
| BlockTensor<'T> | bs | The block tensor specification. |
Returns
| Type | Description |
|---|---|
| Tensor<'T> | The resulting tensor. |
Remarks
The contents of a sub-block are jointed along the dimension determined by its nesting level, i.e.
a sub-block nested n levels within other sub-blocks will be concatenated along dimension n.
The contents of a sub-block must have equal sizes in all dimensions except for the concatenation dimensions.
Examples
// Consider a block matrix of the follow structure.
// +-----------------------------+---------------+
// | | |
// | | |
// | b1 | b2 |
// | (5 x 28) | (5 x 15) |
// | | |
// +---------------------+-------+-------+-------+
// | | | |
// | b3 | b4 | b5 |
// | (3 x 22) | (3 x 14) |(3 x 7)|
// +---------------------+---------------+-------+
//
// It can be specified as follows.
let b1 = HostTensor.zeros [5L; 28L]
let b2 = HostTensor.zeros [5L; 15L]
let b3 = HostTensor.zeros [3L; 22L]
let b4 = HostTensor.zeros [3L; 14L]
let b5 = HostTensor.zeros [3L; 7L]
let r1 = SubBlocks [Block b1; Block b2]
let r2 = SubBlocks [Block b3; Block b4; Block b5]
let a = Tensor.ofBlocks (SubBlocks [r1; r2])
// a.Shape = [8L; 43L]
See Also
static member ofBlocks: Tensor<'T> list -> Tensor<'T>
Builds a vector out of vectors blocks.
Declaration
static member ofBlocks: bs:Tensor<'T> list -> Tensor<'T>
Parameters
| Type | Name | Description |
|---|---|---|
| Tensor<'T> list | bs | The block vector specification. |
Returns
| Type | Description |
|---|---|
| Tensor<'T> | The resulting vector. |
Remarks
The contents of a the vectors are concatenated.
Examples
// Consider a block vector of the follow structure.
// +-----------------------------+---------------+
// | b1 (28) | b2 (15) |
// +-----------------------------+---------------+
//
// It can be specified as follows.
let b1 = HostTensor.zeros [28L]
let b2 = HostTensor.zeros [15L]
let a = Tensor.ofBlocks [b1; b2]
// a.Shape = [43L]
static member ofBlocks: Tensor<'T> list list -> Tensor<'T>
Builds a matrix out of matrix blocks.
Declaration
static member ofBlocks: bs:Tensor<'T> list list -> Tensor<'T>
Parameters
| Type | Name | Description |
|---|---|---|
| Tensor<'T> list list | bs | The matrix blocks. |
Returns
| Type | Description |
|---|---|
| Tensor<'T> | The resulting matrix. |
Remarks
The contents of each list are jointed along the dimension determined by its nesting level, i.e. the elements of the outer lists are concatenated along dimension zero (rows) and the elements of the inner lists are concatenated along dimension one (columns).
The contents of a list must have equal sizes in all dimensions except for the concatenation dimensions.
Examples
// Consider a block matrix of the follow structure.
// +-----------------------------+---------------+
// | | |
// | | |
// | b1 | b2 |
// | (5 x 28) | (5 x 15) |
// | | |
// +---------------------+-------+-------+-------+
// | | | |
// | b3 | b4 | b5 |
// | (3 x 22) | (3 x 14) |(3 x 7)|
// +---------------------+---------------+-------+
//
// It can be specified as follows.
let b1 = HostTensor.zeros [5L; 28L]
let b2 = HostTensor.zeros [5L; 15L]
let b3 = HostTensor.zeros [3L; 22L]
let b4 = HostTensor.zeros [3L; 14L]
let b5 = HostTensor.zeros [3L; 7L]
let bs = [[b1; b2 ]
[b3; b4; b5]]
let a = Tensor.ofBlocks bs
// a.Shape = [8L; 43L]
static member ofBlocks: Tensor<'T> list list list -> Tensor<'T>
Builds a three dimensional tensor out of tensor blocks.
Declaration
static member ofBlocks: bs:Tensor<'T> list list list -> Tensor<'T>
Parameters
| Type | Name | Description |
|---|---|---|
| Tensor<'T> list list list | bs | The tensor blocks. |
Returns
| Type | Description |
|---|---|
| Tensor<'T> | The resulting tensor. |
Remarks
The contents of each list are jointed along the dimension determined by its nesting level, i.e. the elements of the outer-most lists are concatenated along dimension zero and the elements of the middle lists are concatenated along dimension one and the elements of the inner-most lists are concatenated along dimension two.
The contents of a list must have equal sizes in all dimensions except for the concatenation dimensions.