UniqueWithCounts

classe finale pubblica UniqueWithCounts

Trova elementi unici lungo un asse di un tensore.

Questa operazione restituisce un tensore "y" contenente elementi univoci lungo l'"asse" di un tensore. Gli elementi univoci restituiti vengono ordinati nello stesso ordine in cui si trovano lungo "axis" in "x". Questa operazione restituisce anche un tensore "idx" e un tensore "count" che hanno la stessa dimensione del numero di elementi in "x" lungo la dimensione "axis". "idx" contiene l'indice nell'output univoco "y" e "count" contiene il conteggio nell'output univoco "y". In altre parole, per un tensore `1-D` `x` con `axis = None:

`y[idx[i]] = x[i] per i in [0, 1,...,rank(x) - 1]`

Ad esempio:

# tensor 'x' is [1, 1, 2, 4, 4, 4, 7, 8, 8]
 y, idx, count = unique_with_counts(x)
 y ==> [1, 2, 4, 7, 8]
 idx ==> [0, 0, 1, 2, 2, 2, 3, 4, 4]
 count ==> [2, 1, 3, 1, 2]
 
Per un tensore `2-D` `x` con `axis = 0`:
# tensor 'x' is [[1, 0, 0],
 #                [1, 0, 0],
 #                [2, 0, 0]]
 y, idx, count = unique_with_counts(x, axis=0)
 y ==> [[1, 0, 0],
        [2, 0, 0]]
 idx ==> [0, 0, 1]
 count ==> [2, 1]
 
Per un tensore `2-D` `x` con `axis = 1`:
# tensor 'x' is [[1, 0, 0],
 #                [1, 0, 0],
 #                [2, 0, 0]]
 y, idx, count = unique_with_counts(x, axis=1)
 y ==> [[1, 0],
        [1, 0],
        [2, 0]]
 idx ==> [0, 1, 1]
 count ==> [1, 2]
 

Costanti

Corda OP_NAME Il nome di questa operazione, come noto al motore principale di TensorFlow

Metodi pubblici

Uscita <V>
contare ()
Un tensore 1-D.
statico <T estende TType , V estende TNumber > UniqueWithCounts <T, V>
create ( Scope scope, Operando <T> x, Operando <? estende TNumber > asse, Classe<V> outIdx)
Metodo factory per creare una classe che racchiude una nuova operazione UniqueWithCounts.
statico <T estende TType > UniqueWithCounts <T, TInt32 >
create ( ambito ambito , operando <T> x, operando <? estende TNumero > asse)
Metodo factory per creare una classe che racchiude una nuova operazione UniqueWithCounts utilizzando i tipi di output predefiniti.
Uscita <V>
idx ()
Un tensore 1-D.
Uscita <T>
()
Un "Tensore".

Metodi ereditati

Costanti

Stringa finale statica pubblica OP_NAME

Il nome di questa operazione, come noto al motore principale di TensorFlow

Valore costante: "UniqueWithCountsV2"

Metodi pubblici

uscita pubblica <V> conteggio ()

Un tensore 1-D. Il conteggio di ciascun valore di x nell'output y.

public static UniqueWithCounts <T, V> create ( Scope scope, Operand <T> x, Operand <? extends TNumber > axis, Class<V> outIdx)

Metodo factory per creare una classe che racchiude una nuova operazione UniqueWithCounts.

Parametri
scopo ambito attuale
X Un "Tensore".
asse Un "Tensore" di tipo "int32" (impostazione predefinita: Nessuno). L'asse del Tensore per trovare gli elementi unici.
ritorna
  • una nuova istanza di UniqueWithCounts

public static UniqueWithCounts <T, TInt32 > create ( ambito ambito , operando <T> x, operando <? estende TNumber > asse)

Metodo factory per creare una classe che racchiude una nuova operazione UniqueWithCounts utilizzando i tipi di output predefiniti.

Parametri
scopo ambito attuale
X Un "Tensore".
asse Un "Tensore" di tipo "int32" (impostazione predefinita: Nessuno). L'asse del Tensore per trovare gli elementi unici.
ritorna
  • una nuova istanza di UniqueWithCounts

Uscita pubblica <V> idx ()

Un tensore 1-D. Ha lo stesso tipo di x che contiene l'indice di ogni valore di x nell'output y.

Uscita pubblica <T> y ()

Un "Tensore". Elementi unici lungo l'"asse" del "Tensore" x.