tensoreflusso:: ops:: Dove3
#include <math_ops.h>
Seleziona gli elementi da x
y
, a seconda della condition
.
Riepilogo
I tensori x
e y
devono avere tutti la stessa forma e anche l'output avrà quella forma.
Il tensore condition
deve essere scalare se x
y
scalari. Se x
e y
sono vettori o di rango superiore, condition
deve essere uno scalare, un vettore con dimensioni corrispondenti alla prima dimensione di x
oppure deve avere la stessa forma di x
.
Il tensore condition
agisce come una maschera che sceglie, in base al valore di ciascun elemento, se l'elemento/riga corrispondente nell'output deve essere preso da x
(se vero) o y
(se falso).
Se condition
è un vettore e x
sono matrici y
rango superiore, sceglie quale riga (dimensione esterna) copiare y
x
. Se condition
ha la stessa forma di x
e y
, sceglie quale elemento copiare da x
e y
.
Per esempio:
# 'condition' tensor is [[True, False]
# [False, True]]
# 't' is [[1, 2],
# [3, 4]]
# 'e' is [[5, 6],
# [7, 8]]
select(condition, t, e) # => [[1, 6], [7, 4]]
# 'condition' tensor is [True, False]
# 't' is [[1, 2],
# [3, 4]]
# 'e' is [[5, 6],
# [7, 8]]
select(condition, t, e) ==> [[1, 2],
[7, 8]]
Arguments:
- scope: A Scope object
- x: = A
Tensor
which may have the same shape ascondition
. Ifcondition
is rank 1,x
may have higher rank, but its first dimension must match the size ofcondition
. - y: = A
Tensor
with the same type and shape asx
.
Returns:
Constructors and Destructors | |
---|---|
Where3(const ::tensorflow::Scope & scope, ::tensorflow::Input condition, ::tensorflow::Input x, ::tensorflow::Input y) |
Public functions | |
---|---|
node() const | ::tensorflow::Node * |
operator::tensorflow::Input() const |
|
operator::tensorflow::Output() const |
|