เทนเซอร์โฟลว์:: ปฏิบัติการ:: ไม่เรียงลำดับSegmentProd
#include <math_ops.h>
คำนวณผลิตภัณฑ์ตามส่วนของเทนเซอร์
สรุป
อ่าน ส่วนเกี่ยวกับการแบ่งส่วน เพื่อดูคำอธิบายของส่วนต่างๆ
โอเปอเรเตอร์นี้คล้ายกับโอเปอเรเตอร์ผลรวมของเซ็กเมนต์ที่ไม่ได้เรียงลำดับที่พบ (ที่นี่) แทนที่จะคำนวณผลรวมของส่วนต่างๆ จะคำนวณผลคูณของรายการทั้งหมดที่เป็นของกลุ่มดังนี้:
\(output_i = {j...} data[j...]\) โดยที่ผลิตภัณฑ์อยู่เหนือ tuples j...
เช่นว่า segment_ids[j...] == i
ตัวอย่างเช่น:
c = tf.constant([[1,2,3,4], [5,6,7,8], [4,3,2,1]]) tf.unsorted_segment_prod(c, tf.constant([0, 1, 0]), num_segments=2) # ==> [[ 4, 6, 6, 4], # [5, 6, 7, 8]]
หากไม่มีรายการสำหรับ ID เซ็กเมนต์ที่กำหนด i
เอาต์พุตจะเป็น 1
หากรหัสส่วนที่กำหนด i
เป็นค่าลบ ค่าที่เกี่ยวข้องจะถูกละทิ้ง และจะไม่รวมอยู่ในผลลัพธ์
ข้อโต้แย้ง:
- ขอบเขต: วัตถุ ขอบเขต
- Segment_ids: เทนเซอร์ที่มีรูปร่างนำหน้า
data.shape
ผลตอบแทน:
-
Output
: มีรูปร่างเหมือนกับข้อมูล ยกเว้นมิติsegment_ids.rank
แรก ซึ่งถูกแทนที่ด้วยมิติเดียวซึ่งมีขนาดnum_segments
ตัวสร้างและผู้ทำลาย | |
---|---|
UnsortedSegmentProd (const :: tensorflow::Scope & scope, :: tensorflow::Input data, :: tensorflow::Input segment_ids, :: tensorflow::Input num_segments) |
คุณลักษณะสาธารณะ | |
---|---|
operation | |
output |
งานสาธารณะ | |
---|---|
node () const | ::tensorflow::Node * |
operator::tensorflow::Input () const | |
operator::tensorflow::Output () const |
คุณลักษณะสาธารณะ
การดำเนินการ
Operation operation
เอาท์พุท
::tensorflow::Output output
งานสาธารณะ
ไม่เรียงลำดับSegmentProd
UnsortedSegmentProd( const ::tensorflow::Scope & scope, ::tensorflow::Input data, ::tensorflow::Input segment_ids, ::tensorflow::Input num_segments )
โหนด
::tensorflow::Node * node() const
ตัวดำเนินการ::tensorflow::อินพุต
operator::tensorflow::Input() const
ตัวดำเนินการ::tensorflow::เอาต์พุต
operator::tensorflow::Output() const