Enable multi-dimensional and axis support for tf.unique_with_counts
authorYong Tang <yong.tang.github@outlook.com>
Sat, 27 Jan 2018 19:48:35 +0000 (19:48 +0000)
committerYong Tang <yong.tang.github@outlook.com>
Sat, 24 Feb 2018 03:20:45 +0000 (03:20 +0000)
commitb9af4308064dc560c4501523a5508de553000fb0
tree58250ef31a1f02ea66475c59069db9084844d2e9
parent4845809b63c864d81ebdd4dd4532eb3b1d907e07
Enable multi-dimensional and axis support for tf.unique_with_counts

This fix tries to address the issue raised in 16499 to bring
multi-dimensional and axis support for `unique_with_counts`.

When `UniqueV2` kernel was added in 12952, it actually supports
multi-dimensional and axis support for `unique_with_counts` as well,
just not registered.

This fix:
1. Register `UniqueWithCountsV2` kernel to have axis support.
2. Hide both `UniqueWithCounts` and `UniqueWithCountsV2`
3. Add python unique_with_counts wrapper to call `gen_array_ops._unique_with_counts`
4. If APi review passes and the PR merges, `unique_with_counts` will switch to `gen_array_ops._unique_with_counts_v2` (in 3 weeks).

This fix fixes 16499.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
tensorflow/core/kernels/unique_op.cc
tensorflow/core/ops/array_ops.cc