เทนเซอร์โฟลว์ :: ops :: SparseSegmentSumWithNumSegments
#include <math_ops.h>
คำนวณผลรวมตามส่วนที่เบาบางของเทนเซอร์
สรุป
เช่นเดียวกับ SparseSegmentSum
แต่อนุญาตให้มีรหัสที่ขาดหายไปใน segment_ids
หาก id ไม่ถูกต้องเทนเซอร์ output
ที่ตำแหน่งนั้นจะเป็นศูนย์
อ่าน หัวข้อเกี่ยวกับการแบ่งกลุ่ม เพื่อดูคำอธิบายของกลุ่ม
ตัวอย่างเช่น:
c = tf.constant([[1,2,3,4], [-1,-2,-3,-4], [5,6,7,8]])
tf.sparse_segment_sum_with_num_segments( c, tf.constant([0, 1]), tf.constant([0, 0]), num_segments=3) # => [[0 0 0 0] # [0 0 0 0] # [0 0 0 0]]
tf.sparse_segment_sum_with_num_segments(c, tf.constant([0, 1]), tf.constant([0, 2], num_segments=4)) # => [[ 1 2 3 4] # [ 0 0 0 0] # [-1 -2 -3 -4] # [ 0 0 0 0]]
อาร์กิวเมนต์:
- ขอบเขต: วัตถุ ขอบเขต
- ดัชนี: A 1-D tensor มีอันดับเดียวกับ
segment_ids
- segment_ids: เทนเซอร์ 1 มิติ ควรเรียงลำดับค่าและสามารถทำซ้ำได้
- จำนวนส่วน: ควรเท่ากับจำนวนของรหัสกลุ่มที่แตกต่างกัน
ผลตอบแทน:
-
Output
: มีรูปร่างเหมือนกับข้อมูลยกเว้นมิติข้อมูล 0 ซึ่งมีขนาดnum_segments
ส่วน
ผู้สร้างและผู้ทำลาย | |
---|---|
SparseSegmentSumWithNumSegments (const :: tensorflow::Scope & scope, :: tensorflow::Input data, :: tensorflow::Input indices, :: 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
หน้าที่สาธารณะ
SparseSegmentSumWithNumSegments
SparseSegmentSumWithNumSegments( const ::tensorflow::Scope & scope, ::tensorflow::Input data, ::tensorflow::Input indices, ::tensorflow::Input segment_ids, ::tensorflow::Input num_segments )
โหนด
::tensorflow::Node * node() const
ตัวดำเนินการ :: tensorflow :: อินพุต
operator::tensorflow::Input() const
ตัวดำเนินการ :: tensorflow :: เอาท์พุท
operator::tensorflow::Output() const