average(a, axis=None, weights=None, returned=False)¶
Returns the weighted average along an axis.
a (cupy.ndarray) – Array to compute average.
axis (int) – Along which axis to compute average. The flattened array is used by default.
weights (cupy.ndarray) – Array of weights where each element corresponds to the value in
None, all the values in
ahave a weight equal to one.
returned (bool) – If
True, a tuple of the average and the sum of weights is returned, otherwise only the average is returned.
- The average of the input array
along the axis and the sum of weights.
- Return type
cupy.ndarray or tuple of cupy.ndarray
This function may synchronize the device if