tensorflow:: ops:: Where3

#include <math_ops.h>

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

まとめ

xテンソルとyテンソルはすべて同じ形状である必要があり、出力も同じ形状になります。

xとyがスカラーの場合x conditionテンソルはスカラーでなければなりません。xとyがベクトルまたはそれ以上のランクの場合、 conditionスカラー、 xの1次元目と同じサイズのベクトル、またはxと同じ形状でなければなりません。

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

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 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 

operator::tensorflow::Input

 operator::tensorflow::Input() const 

operator::tensorflow::Output

 operator::tensorflow::Output() const