تدفق التوتر:: العمليات:: SparseSegmentSumWithNumSegments

#include <math_ops.h>

يحسب المجموع على طول شرائح متفرقة من الموتر.

ملخص

مثل SparseSegmentSum ، ولكنه يسمح بالمعرفات المفقودة في segment_ids . إذا كان المعرف مفقودًا، فسيتم صفر موتر 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-D. له نفس رتبة segment_ids .
  • section_ids: موتر ثنائي الأبعاد. يجب فرز القيم ويمكن تكرارها.
  • 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

 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