-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Reduction Operations
Frank Seide edited this page Aug 27, 2016
·
11 revisions
Reduce an input, e.g. compute sum or mean over elements.
ReduceSum (z, axis=None)
ReduceLogSum (z, axis=None)
ReduceMean (z, axis=None)
ReduceMin (z, axis=None)
ReduceMax (z, axis=None)
-
z
: data to reduce -
axis
(default:None
): if specified, perform reduction along this axis only
Reduced value
These functions compute aggregates (sum, mean, etc.) over all values of an input vector or tensor. Available aggregations are:
-
ReduceSum()
: the sum over the elements -
ReduceLogSum()
: the sum over elements in log representations (logC = log (exp (logA) + exp (logB))
) -
ReduceMean()
: the mean over the elements -
ReduceSum()
: the maximum value of the elements -
ReduceSum()
: the minimum value
By default, aggregation is done over all elements.
In case of a tensor with rank>1, the optional axis
parameter specifies a single axis
that the reduction is performed over.
For example, axis=2
applied to a [M x N]
-dimensional matrix would aggregate over all columns,
yielding a [M x 1]
result.
If the input is a sequence, reduction is performed separately for every sequence item.
These operations do not support reduction over sequences.
Instead, you can achieve this with a recurrence.
For example, to sum up all elements of a sequence x
, you can say:
sum = x + PastValue (0, sum, initialHiddenActivation=0)