جریان تنسور:: عملیات:: 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]]
استدلال ها:
- scope: یک شی Scope
- شاخص ها: یک تانسور 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) |
توابع عمومی | |
---|---|
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