tensorflow:: ops:: Where3

#include <math_ops.h>

เลือกองค์ประกอบจาก x หรือ y ขึ้นอยู่กับ condition

สรุป

เทนเซอร์ x และ y ทั้งหมดต้องมีรูปร่างเหมือนกัน และผลลัพธ์ก็จะมีรูปร่างนั้นด้วย

ถ้า x และ y เป็นค่าสเกลาร์ เทนเซอร์ condition จะต้องเป็นค่าสเกลาร์ แต่ถ้า 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 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() const 

ตัวดำเนินการ::เทนเซอร์โฟลว์::เอาต์พุต

 operator::tensorflow::Output() const