Chalkboard - v3.1.0
    Preparing search index...

    Function sum

    • Calculates the sum of a tensor along a given axis, or all entries if no axis is specified.

      Parameters

      • tens: ChalkboardTensor

        The tensor

      • Optionalaxis: number

        An axis less than the rank, removed from the result, while omitting it reduces all entries to a number

      Returns ChalkboardTensor

      const result = Chalkboard.tens.sum([[1, 2, 3], [4, 5, 6]], 0); // Returns [5, 7, 9]