tensorflow::ops::Where3
#include <math_ops.h> Memilih elemen dari x atau y , tergantung pada condition .
Ringkasan
Tensor x dan y harus memiliki bentuk yang sama, dan outputnya juga akan memiliki bentuk tersebut.
Tensor condition harus berupa skalar jika x dan y adalah skalar. Jika x dan y adalah vektor atau berperingkat lebih tinggi, maka condition harus berupa skalar, vektor dengan ukuran yang sesuai dengan dimensi pertama x , atau harus memiliki bentuk yang sama dengan x .
Tensor condition bertindak sebagai masker yang memilih, berdasarkan nilai pada setiap elemen, apakah elemen/baris yang sesuai dalam output harus diambil dari x (jika benar) atau y (jika salah).
Jika condition berupa vektor dan x serta y adalah matriks berperingkat lebih tinggi, maka ia memilih baris (dimensi terluar) mana yang akan disalin dari x dan y . Jika condition memiliki bentuk yang sama dengan x dan y , maka ia memilih elemen mana yang akan disalin dari x dan y .
Misalnya:
# '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
Tensorwhich may have the same shape ascondition. Ifconditionis rank 1,xmay have higher rank, but its first dimension must match the size ofcondition. - y: = A
Tensorwith 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 attributes |
|
|---|---|
operation
|
|
output
|
|
Public functions |
|
|---|---|
node() const
|
::tensorflow::Node *
|
operator::tensorflow::Input() const
|
|
operator::tensorflow::Output() const
|
|
Public attributes
keluaran
::tensorflow::Output output
Fungsi publik
Di mana3
Where3( const ::tensorflow::Scope & scope, ::tensorflow::Input condition, ::tensorflow::Input x, ::tensorflow::Input y )
simpul
::tensorflow::Node * node() const
operator::tensorflow::Input
operator::tensorflow::Input() const
operator::tensorflow::Output
operator::tensorflow::Output() const