เทนเซอร์โฟลว์:: ปฏิบัติการ:: ที่ไหน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 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