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
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
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
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2026-11-05 بهوقت ساعت هماهنگ جهانی.