Where

lezione finale pubblica Dove

Restituisce posizioni di valori diversi da zero/veri in un tensore.

Questa operazione restituisce le coordinate degli elementi veri in "condizione". Le coordinate vengono restituite in un tensore 2D in cui la prima dimensione (righe) rappresenta il numero di elementi veri e la seconda dimensione (colonne) rappresenta le coordinate degli elementi veri. Tieni presente che la forma del tensore di output può variare a seconda del numero di valori veri presenti nella "condizione". Gli indici vengono emessi in ordine di riga principale.

Ad esempio:

# 'input' tensor is [[True, False]
 #                    [True, False]]
 # 'input' has two true values, so output has two coordinates.
 # 'input' has rank of 2, so coordinates have two indices.
 where(input) ==> [[0, 0],
                   [1, 0]]
 
 # `condition` tensor is [[[True, False]
 #                     [True, False]]
 #                    [[False, True]
 #                     [False, True]]
 #                    [[False, False]
 #                     [False, True]]]
 # 'input' has 5 true values, so output has 5 coordinates.
 # 'input' has rank of 3, so coordinates have three indices.
 where(input) ==> [[0, 0, 0],
                   [0, 1, 0],
                   [1, 0, 1],
                   [1, 1, 1],
                   [2, 1, 1]]
 
 # `condition` tensor is [[[1.5,  0.0]
 #                     [-0.5, 0.0]]
 #                    [[0.0,  0.25]
 #                     [0.0,  0.75]]
 #                    [[0.0,  0.0]
 #                     [0.0,  0.01]]]
 # 'input' has 5 nonzero values, so output has 5 coordinates.
 # 'input' has rank of 3, so coordinates have three indices.
 where(input) ==> [[0, 0, 0],
                   [0, 1, 0],
                   [1, 0, 1],
                   [1, 1, 1],
                   [2, 1, 1]]
 
 # `condition` tensor is [[[1.5 + 0.0j, 0.0  + 0.0j]
 #                     [0.0 + 0.5j, 0.0  + 0.0j]]
 #                    [[0.0 + 0.0j, 0.25 + 1.5j]
 #                     [0.0 + 0.0j, 0.75 + 0.0j]]
 #                    [[0.0 + 0.0j, 0.0  + 0.0j]
 #                     [0.0 + 0.0j, 0.01 + 0.0j]]]
 # 'input' has 5 nonzero magnitude values, so output has 5 coordinates.
 # 'input' has rank of 3, so coordinates have three indices.
 where(input) ==> [[0, 0, 0],
                   [0, 1, 0],
                   [1, 0, 1],
                   [1, 1, 1],
                   [2, 1, 1]]
 

Costanti

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

Metodi pubblici

Uscita < TInt64 >
comeuscita ()
Restituisce l'handle simbolico del tensore.
statico Dove
create ( ambito ambito , operando <? estende TType > condizione)
Metodo factory per creare una classe che racchiude una nuova operazione Where.
Uscita < TInt64 >
indice ()

Metodi ereditati

Costanti

Stringa finale statica pubblica OP_NAME

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

Valore costante: "Dove"

Metodi pubblici

output pubblico < TInt64 > asOutput ()

Restituisce l'handle simbolico del tensore.

Gli input per le operazioni TensorFlow sono output di un'altra operazione TensorFlow. Questo metodo viene utilizzato per ottenere un handle simbolico che rappresenta il calcolo dell'input.

public static Dove creare (ambito ambito , operando <? estende TType > condizione)

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

Parametri
scopo ambito attuale
ritorna
  • una nuova istanza di Where

output pubblico < TInt64 > indice ()