Method diagMatAxis
static member diagMatAxis: int -> int -> Tensor<'T> -> Tensor<'T>
Creates a tensor with the specified diagonal along the given axes.
Declaration
static member diagMatAxis: ax1:int -> ax2:int -> a:Tensor<'T> -> Tensor<'T>
Parameters
Type | Name | Description |
---|---|---|
int | ax1 | The first dimension of the diagonal. |
int | ax2 | The seconds dimension of the diagonal. |
Tensor<'T> | a | The values for the diagonal. |
Returns
Type | Description |
---|---|
Tensor<'T> | A tensor having the values |
Remarks
A new tensor with the same shape as a
but with axis ax2
inserted
is created. The size of axis ax2
is set to the size of axis ax1
.
The diagonal over axes ax1
and ax2
is filled with the elements of
tensor a
. The other elements are set to zero.
Examples
let a = HostTensor.zeros [4L; 3L]
let b = Tensor.diagMatAxis 0 1 a // b.Shape = [4L; 4L; 3L]