Function identity

  • Create a square 2D identity Tensor.

    Remarks

    This is similar to the eye API of other tensor frameworks.

    Example

      // 128x128 identity tensor
    const t = sm.identity(128)

    Returns

    A new identity Tensor.

    Parameters

    • dim: number

      The dimension of the output Tensor

    Returns Tensor

Generated using TypeDoc