unique¶
dragon.vm.tensorflow.
unique
(
x,
name=None,
**kwargs
)[source]¶Return the unique elements of input.
Unique elements and index where input mapping to are returned:
x = tf.constant([1, 2, 3, 2]) y, index = tf.unique(x) print(y) # [1, 2, 3] print(index) # [0, 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.