tensorflow:: عملیات:: Where3

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