tf.contrib.data.group_by_reducer(
key_func,
reducer
)
Defined in tensorflow/contrib/data/python/ops/grouping.py
.
A transformation that groups elements and performs a reduction. (deprecated)
This transformation maps element of a dataset to a key using key_func
and
groups the elements by key. The reducer
is used to process each group; its
init_func
is used to initialize state for each group when it is created, the
reduce_func
is used to update the state every time an element is mapped to
the matching group, and the finalize_func
is used to map the final state to
an output value.
Args:
key_func
: A function mapping a nested structure of tensors (having shapes and types defined byself.output_shapes
andself.output_types
) to a scalartf.int64
tensor.reducer
: An instance ofReducer
, which captures the reduction logic using theinit_func
,reduce_func
, andfinalize_func
functions.
Returns:
A Dataset
transformation function, which can be passed to
tf.data.Dataset.apply
.