テンソルフロー::作戦::どこ3
#include <math_ops.h>
condition
に応じて、 x
またはy
から要素を選択します。
まとめ
x
およびy
テンソルはすべて同じ形状を持つ必要があり、出力もその形状になります。
x
とy
がスカラーの場合、 condition
テンソルはスカラーでなければなりません。 x
とy
ベクトル以上のランクである場合、 condition
はスカラー、 x
の最初の次元と一致するサイズを持つベクトル、またはx
と同じ形状を持つ必要があります。
condition
テンソルは、各要素の値に基づいて、出力内の対応する要素/行をx
(true の場合) またはy
(false の場合) から取得するかを選択するマスクとして機能します。
condition
がベクトルで、 x
とy
高位の行列である場合、 x
とy
からどの行 (外側の次元) をコピーするかを選択します。 condition
x
およびy
と同じ形状を持つ場合、 x
およびy
からどの要素をコピーするかを選択します。
例えば:
# '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 |
|