def test_output_values(self, reducer, expected_values):
    input_values_np = np.array([[0.1, -0.1],
                                [0.2, -0.2],
                                [0.3, -0.3],
                                [0.4, -0.4],
                                [0.5, -0.5],
                                [0.6, -0.6],
                                [0.7, -0.7],
                                [0.8, -0.8],
                                [0.9, -0.9],
                                [1., -1.]], dtype=np.float32)
    input_indices_np = np.array([1, 2, 2, 3, 3, 3, 4, 4, 5, 4], dtype=np.int32)
    num_groups_np = np.array(7, dtype=np.int32)

    input_indices = tf.constant(input_indices_np, dtype=tf.int32)
    input_values = tf.constant(input_values_np, dtype=tf.float32)
    num_groups = tf.constant(num_groups_np, dtype=tf.int32)

    reduced = reducer(input_values, input_indices, num_groups)

    with tf.Session() as sess:
      reduced_out = sess.run(reduced)

    self.assertNDArrayNear(
        np.array(expected_values, dtype=np.float32), reduced_out, err=1e-4)