tf.data.experimental.group_by_reducer | TensorFlow v2.16.1 (original) (raw)
tf.data.experimental.group_by_reducer
Stay organized with collections Save and categorize content based on your preferences.
A transformation that groups elements and performs a reduction.
View aliases
Compat aliases for migration
SeeMigration guide for more details.
tf.compat.v1.data.experimental.group_by_reducer
tf.data.experimental.group_by_reducer(
key_func, reducer
)
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; itsinit_func
is used to initialize state for each group when it is created, thereduce_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 by self.output_shapes andself.output_types) to a scalar tf.int64 tensor. |
reducer | An instance of Reducer, which captures the reduction logic using the init_func, reduce_func, and finalize_func functions. |
Returns |
---|
A Dataset transformation function, which can be passed totf.data.Dataset.apply. |
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2024-04-26 UTC.