tensorflow:: אופס:: איפה 3
#include <math_ops.h>
בוחר אלמנטים מ- x
או y
, בהתאם condition
.
תַקצִיר
הטנסורים x
ו- y
חייבים להיות בעלי אותה צורה, ולפלט תהיה גם צורה זו.
condition
טנזור חייב להיות סקלרי אם x
ו- y
הם סקלרים. אם x
ו- y
הם וקטורים או דרגה גבוהה יותר, condition
חייב להיות סקלרי, וקטור עם גודל התואם לממד הראשון של x
, או חייב להיות בעל צורה זהה ל- 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 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 |
|