テンソルフロー::作戦::どこ3

#include <math_ops.h>

conditionに応じて、 xまたはyから要素を選択します。

まとめ

xおよびyテンソルはすべて同じ形状を持つ必要があり、出力もその形状になります。

xyがスカラーの場合、 conditionテンソルはスカラーでなければなりません。 xyがベクトル以上のランクである場合、 conditionスカラー、 xの最初の次元と一致するサイズを持つベクトル、またはxと同じ形状を持つ必要があります。

conditionテンソルは、各要素の値に基づいて、出力内の対応する要素/行をx (true の場合) またはy (false の場合) から取得するかを選択するマスクとして機能します。

conditionがベクトルで、 xy高位の行列である場合、 xyからどの行 (外側の次元) をコピーするかを選択します。 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 as condition. If condition is rank 1, x may have higher rank, but its first dimension must match the size of condition.
  • y: = A Tensor with the same type and shape as x.

Returns:

  • Output: = A Tensor with the same type and shape as x and y.

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

operation

Operation operation

出力

::tensorflow::Output output

公共機能

どこ3

 Where3(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input condition,
  ::tensorflow::Input x,
  ::tensorflow::Input y
)

ノード

::tensorflow::Node * node() const 

演算子::tensorflow::入力

 operator::tensorflow::Input() const 

演算子::tensorflow::出力

 operator::tensorflow::Output() const