Matrix Sum Python, sum () is a NumPy function used to calculate the sum of array elements.