message: [tf.data] Adding a test for `group_by_reducer` that illustrates how to apply different logic to different components.
diff: @@ -175,6 +175,28 @@ class GroupByReducerTest(test.TestCase):
  dataset.apply(
  grouping.group_by_reducer(lambda _: "wrong", reducer))
  + def testTuple(self):
  + def init_fn(_):
  + return np.array([], dtype=np.int64), np.int64(0)
  +
  + def reduce_fn(state, value):
  + s1, s2 = state
  + v1, v2 = value
  + return array_ops.concat([s1, [v1]], 0), s2 + v2
  +
  + def finalize_fn(s1, s2):
  + return s1, s2
  +
  + reducer = grouping.Reducer(init_fn, reduce_fn, finalize_fn)
  + dataset = dataset_ops.Dataset.zip(
  + (dataset_ops.Dataset.range(10), dataset_ops.Dataset.range(10))).apply(
  + grouping.group_by_reducer(lambda x, y: np.int64(0), reducer))
  + get_next = dataset.make_one_shot_iterator().get_next()
  + with self.test_session() as sess:
  + x, y = sess.run(get_next)
  + self.assertAllEqual(x, np.asarray([x for x in range(10)]))
  + self.assertEqual(y, 45)
  +
  class GroupByWindowTest(test.TestCase):
  