Show / Hide Table of Contents

    Method diag

    static member diag: Tensor<'T> -> Tensor<'T>

    Returns a view of the diagonal of the matrix.

    Declaration
    static member diag: a:Tensor<'T> -> Tensor<'T>
    Parameters
    Type Name Description
    Tensor<'T> a

    A square matrix.

    Returns
    Type Description
    Tensor<'T>

    The diagonal vector.

    Remarks

    The matrix must be square.

    If the specified tensor has more than two dimensions, the diagonals along the last two dimensions are returned as a tensor.

    A view of the original tensor is returned and the storage is shared. Modifications done to the returned tensor will affect the original tensor.

    Examples
     let a = HostTensor.zeros [3L; 3L]
     let b = Tensor.diag a // b.Shape = [3L]
    See Also
    static member diagAxis: int -> int -> Tensor<'T> -> Tensor<'T>
    static member diagMat: Tensor<'T> -> Tensor<'T>
    Back to top Generated by DocFX