tensorflow::ops::SparseSegmentSumWithNumSegments

#include <math_ops.h>

คำนวณผลรวมตามส่วนย่อยที่เบาบางของเทนเซอร์

สรุป

คล้ายกับ SparseSegmentSum แต่ยอมให้มีค่า id ใน 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]]

ข้อโต้แย้ง:

  • ขอบเขต: วัตถุ ขอบเขต
  • ดัชนี: เทนเซอร์ 1 มิติ มีลำดับชั้นเดียวกับ segment_ids
  • segment_ids: เทนเซอร์ 1 มิติ ค่าต่างๆ ควรเรียงลำดับและสามารถซ้ำกันได้
  • num_segments: ควรเท่ากับจำนวนรหัสเซ็กเมนต์ที่ไม่ซ้ำกัน

การส่งคืนสินค้า:

  • 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(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input data,
  ::tensorflow::Input indices,
  ::tensorflow::Input segment_ids,
  ::tensorflow::Input num_segments
)

โหนด

::tensorflow::Node * node() const 

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

 operator::tensorflow::Input() const 

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

 operator::tensorflow::Output() const