Method diagMat
static member diagMat: Tensor<'T> -> Tensor<'T>
Creates a matrix with the specified diagonal.
Declaration
static member diagMat: a:Tensor<'T> -> Tensor<'T>
Parameters
Type | Name | Description |
---|---|---|
Tensor<'T> | a | The vector containing the values for the diagonal. |
Returns
Type | Description |
---|---|
Tensor<'T> | A matrix having the values |
Remarks
A square matrix with the same size as a
is created.
The diagonal is filled with the elements of vector a
.
The other elements are set to zero.
If the specified tensor has more than one dimension, the operation is performed batch-wise on the last dimension.
Examples
let a = HostTensor.zeros [5L]
let b = Tensor.diag a // b.Shape = [5L; 5L]