unique_with_counts¶
dragon.vm.tensorflow.
unique_with_counts
(
x,
name=None,
**kwargs
)[source]¶Return the unique elements of input with counts.
Unique elements, remapping index and counts are returned:
x = tf.constant([1, 2, 3, 2]) y, index, counts = tf.unique_with_counts(x) print(y) # [1, 2, 3] print(index) # [0, 1, 2, 1] print(counts) # [1, 2, 1]
- Parameters:
- x (dragon.Tensor) – The input tensor.
- name (str, optional) – The operation name.
- Returns:
- dragon.Tensor – The output tensor.
- dragon.Tensor – The inverse index tensor.
- dragon.Tensor – The counts tensor.