chainer.functions.average¶
-
chainer.functions.
average
(x, axis=None, weights=None, keepdims=False)[source]¶ Calculate weighted average of array elements over a given axis.
- Parameters
x (
Variable
or N-dimensional array) – Elements to sum.axis (None or int or tuple of int) – Axis which the method is performed. With the default (axis = None) it performs a mean over all the dimensions of the input array.
weights (None or
Variable
or N-dimensional array) – An array holding weights to calculate weighted average. If it isNone
, all weights are assumed to be one. Whenaxis
isNone
,weights
must have the same shape ofx
. And whenaxis
isint
, it must be 1-D array satisfingweights.shape == (x.shape[axis],)
.keepdims (bool) – If
True
, the specified axes are remained as axes of length one.
- Returns
Output variable.
- Return type