tensorflow::ops::SparseSegmentSum
#include <math_ops.h>Tính tổng dọc theo các đoạn thưa của một tensor.
Bản tóm tắt
Hãy đọc phần về phân khúc thị trường để hiểu rõ hơn về khái niệm phân khúc.
Tương tự như SegmentSum , nhưng segment_ids có thể có thứ hạng nhỏ hơn chiều đầu tiên của data , chọn một tập con của chiều 0, được chỉ định bởi indices .
Ví dụ:
c = tf.constant([[1,2,3,4], [-1,-2,-3,-4], [5,6,7,8]])
# Select two rows, one segment. tf.sparse_segment_sum(c, tf.constant([0, 1]), tf.constant([0, 0])) # => [[0 0 0 0]]
# Select two rows, two segment. tf.sparse_segment_sum(c, tf.constant([0, 1]), tf.constant([0, 1])) # => [[ 1 2 3 4] # [-1 -2 -3 -4]]
# Select all rows, two segments. tf.sparse_segment_sum(c, tf.constant([0, 1, 2]), tf.constant([0, 0, 1])) # => [[0 0 0 0] # [5 6 7 8]]
# Which is equivalent to: tf.segment_sum(c, tf.constant([0, 0, 1]))
Luận điểm:
- phạm vi: Một đối tượng Phạm vi
- indices: Một tensor 1 chiều. Có cùng hạng với
segment_ids. - segment_ids: Một tensor 1 chiều. Các giá trị nên được sắp xếp và có thể lặp lại.
Trả về:
-
Output: Có hình dạng giống dữ liệu, ngoại trừ chiều 0 có kích thướck, là số lượng phân đoạn.
Hàm khởi tạo và hàm hủy | |
|---|---|
SparseSegmentSum (const :: tensorflow::Scope & scope, :: tensorflow::Input data, :: tensorflow::Input indices, :: tensorflow::Input segment_ids) |
Thuộc tính công khai | |
|---|---|
operation | |
output | |
Chức năng công cộng | |
|---|---|
node () const | ::tensorflow::Node * |
operator::tensorflow::Input () const | |
operator::tensorflow::Output () const | |
Thuộc tính công khai
hoạt động
Operation operation
đầu ra
::tensorflow::Output output
Chức năng công cộng
Tổng phân đoạn thưa thớt
SparseSegmentSum( const ::tensorflow::Scope & scope, ::tensorflow::Input data, ::tensorflow::Input indices, ::tensorflow::Input segment_ids )
nút
::tensorflow::Node * node() const
operator::tensorflow::Input
operator::tensorflow::Input() const
operator::tensorflow::Output
operator::tensorflow::Output() const