Chalkboard - v3.1.0
    Preparing search index...

    Function identity

    • Initializes the identity tensor, with all axes of the given dimension and entries of one where all indices are equal, zero elsewhere.

      Parameters

      • dimension: number

        The length of every axis

      • Optionalrank: number = 2

        The number of axes

      Returns ChalkboardTensor

      const result = Chalkboard.tens.identity(2, 3); // Returns [[[1, 0], [0, 0]], [[0, 0], [0, 1]]]